Changeset 3749
- Timestamp:
- 10/19/05 04:30:39 (3 years ago)
- Files:
-
- mini-posts/trunk/mini-posts.php (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
mini-posts/trunk/mini-posts.php
r439 r3749 4 4 Plugin URI: http://doocy.net/mini-posts/ 5 5 Description: An approach to "asides", or small posts. Allows you to mark entries as "mini" posts and handle them differently than normal posts. <strong>Requires WordPress 1.5.</strong> 6 Version: 0.5. 16 Version: 0.5.2 7 7 Author: Morgan Doocy 8 8 Author URI: http://doocy.net/ … … 40 40 (WARNING: The argument sequence of get_mini_posts() has changed to accommodate this.) 41 41 0.5.1 - Added 'save_post' hook 42 0.5.2 - Fixed label id for "This is a mini post" checkbox 43 - Added pagination on Options page 44 - Changed all references to the plugin's filename to basename(__FILE__), to avoid file naming issues 45 - Added aliases to JOIN and WHERE clauses to avoid collisions with other plugins 46 (thanks, Jerome and Mark!) 42 47 43 48 */ 44 49 45 50 if (is_plugin_page()) { 51 include(ABSPATH.'wp-blog-header.php'); 52 53 $paged_val = get_query_var('paged'); 54 $paged_val = $paged_val ? "&paged=$paged_val" : ''; 46 55 47 56 if (isset($_POST["update_options"])) { … … 49 58 update_option('suppress_autop_on_mini_posts', $_POST['suppress_autop_on_mini_posts'] == 1 ? 1 : 0); 50 59 update_option('filter_mini_posts_from_feeds', $_POST['filter_mini_posts_from_feeds'] == 1 ? 1 : 0); 51 echo '<div class="updated"><p><strong>' . __('Options updated.', 'MiniPosts') . '</strong></p></div>';60 echo '<div class="updated"><p><strong>' . __('Options saved.', 'MiniPosts') . '</strong></p></div>'; 52 61 } 53 62 elseif (isset($_POST["update_miniposts"])) { 54 include(ABSPATH.'wp-blog-header.php');55 56 63 $is_mini_post = $_POST["is_mini_post"]; 57 64 foreach ($posts as $post) { … … 60 67 add_post_meta($post->ID, '_mini_post', $setting); 61 68 } 62 header("Location: admin.php?page=mini-posts.php&updated=true");69 header("Location: options-general.php?page=" . basename(__FILE__) . "&miniposts_updated=true$paged_val"); 63 70 exit(); 64 71 } … … 71 78 <div class="wrap"> 72 79 <h2><?php _e('Mini Post Options', 'MiniPosts') ?></h2> 73 <form method="post" >80 <form method="post" action="./options-general.php?page=<?php echo basename(__FILE__) . $paged_val; ?>"> 74 81 <table width="100%" cellspacing="2" cellpadding="5" class="editform"> 75 82 <tr valign="top"> … … 90 97 <?php 91 98 92 if ($_GET[" updated"] == "true") {99 if ($_GET["miniposts_updated"] == "true") { 93 100 94 101 ?> … … 101 108 <div class="wrap"> 102 109 <h2><?php _e('Mini Post Manager', 'MiniPosts') ?></h2> 103 <form method="post" >110 <form method="post" action="./options-general.php?page=<?php echo basename(__FILE__); ?>&noheader=true<?php echo $paged_val; ?>"> 104 111 <table width="100%" cellpadding="3" cellspacing="3"> 105 112 <thead> … … 117 124 <tbody> 118 125 <?php 119 120 include(ABSPATH.'wp-blog-header.php');121 126 122 127 foreach($posts as $post) … … 141 146 </tbody> 142 147 </table> 148 <div class="navigation"> 149 <?php 150 // Remove 'miniposts_updated' value from query string, if present, so that 151 // get_pagenum_link() doesn't perpetuate it. 152 $_SERVER['REQUEST_URI'] = preg_replace('/&miniposts_updated=true/', '', $_SERVER['REQUEST_URI']); 153 $_SERVER['REQUEST_URI'] = preg_replace('/\?miniposts_updated=true&/', '?', $_SERVER['REQUEST_URI']); 154 $_SERVER['REQUEST_URI'] = preg_replace('/\?miniposts_updated=true/', '', $_SERVER['REQUEST_URI']); 155 ?> 156 <div class="alignleft"><?php next_posts_link(__('« Previous Entries')) ?></div> 157 <div class="alignright"><?php previous_posts_link(__('Next Entries »')) ?></div> 158 </div> 143 159 <div class="submit"><input type="submit" name="update_miniposts" value="<?php _e('Update Mini Posts', 'MiniPosts') ?> »" /></div> 144 160 </form> … … 267 283 268 284 if (!is_plugin_page() && $pagenow != 'post.php' && $pagenow != 'edit.php' && get_settings('filter_mini_posts_from_loop') && !is_single() && !is_archive() && !is_page() && (is_feed() && get_settings('filter_mini_posts_from_feeds') || !is_feed()) && !stristr($text, "wp_postmeta")) { 269 $text .= " LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id)";285 $text .= " LEFT JOIN $wpdb->postmeta AS miniposts_meta ON ($wpdb->posts.ID = miniposts_meta.post_id)"; 270 286 } 271 287 … … 277 293 278 294 if (!is_plugin_page() && $pagenow != 'post.php' && $pagenow != 'edit.php' && get_settings('filter_mini_posts_from_loop') && !is_single() && !is_archive() && !is_page() && (is_feed() && get_settings('filter_mini_posts_from_feeds') || !is_feed())) { 279 $text .= " AND ( $wpdb->postmeta.meta_key = '_mini_post' AND $wpdb->postmeta.meta_value = 0)";295 $text .= " AND (miniposts_meta.meta_key = '_mini_post' AND miniposts_meta.meta_value = 0)"; 280 296 } 281 297 … … 323 339 $check = $is_mini ? 'checked="checked" ' : ''; 324 340 325 echo '<fieldset><legend><a href="http://doocy.net/mini-posts/help/" title="Help with MiniPosts">' . __('Mini Post', 'MiniPosts') . '</a></legend>';326 echo '<label for=" mini_post"><input type="checkbox" name="is_mini_post" id="is_mini_post" value="1" '. $check . '/> '. __('This is a mini post', 'MiniPosts') . '</label></fieldset>';341 echo '<fieldset><legend><a href="http://doocy.net/mini-posts/help/" title="Help with MiniPosts">' . __('MiniPosts', 'MiniPosts') . '</a></legend>'; 342 echo '<label for="is_mini_post"><input type="checkbox" name="is_mini_post" id="is_mini_post" value="1" '. $check . '/> '. __('This is a mini post', 'MiniPosts') . '</label></fieldset>'; 327 343 } 328 344 … … 334 350 335 351 function mini_admin_menu() { 336 add_options_page(__('Mini Post Manager', 'MiniPosts'), __('MiniPosts', 'MiniPosts'), 5, 'mini-posts.php');352 add_options_page(__('Mini Post Manager', 'MiniPosts'), __('MiniPosts', 'MiniPosts'), 5, basename(__FILE__)); 337 353 } 338 354
