| @@ -1,8 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | function fwp_linkedit_single_submit ($status = NULL) { |
| 3 | - global $wp_db_version; | |
| 4 | - if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) : | |
| 3 | + if (fwp_test_wp_version(FWP_SCHEMA_25, FWP_SCHEMA_27)) : | |
| 5 | 4 | ?> |
| 6 | 5 | <div class="submitbox" id="submitlink"> |
| 7 | 6 | <div id="previewview"></div> |
| 8 | 7 | <div class="inside"> |
| @@ -32,10 +31,9 @@ | ||
| 32 | 31 | endif; |
| 33 | 32 | } |
| 34 | 33 | |
| 35 | 34 | function fwp_linkedit_periodic_submit ($caption = NULL) { |
| 36 | - global $wp_db_version; | |
| 37 | - if (!(isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25)) : | |
| 35 | + if (!fwp_test_wp_version(FWP_SCHEMA_25)) : | |
| 38 | 36 | if (is_null($caption)) : $caption = __('Save Changes »'); endif; |
| 39 | 37 | ?> |
| 40 | 38 | <p class="submit"> |
| 41 | 39 | <input type="submit" name="submit" value="<?php print $caption; ?>" /> |
| @@ -43,8 +41,38 @@ | ||
| 43 | 41 | <?php |
| 44 | 42 | endif; |
| 45 | 43 | } |
| 46 | 44 | |
| 45 | +function fwp_linkedit_single_submit_closer ($caption = NULL) { | |
| 46 | + if (fwp_test_wp_version(FWP_SCHEMA_27)) : | |
| 47 | + if (is_null($caption)) : $caption = __('Save Changes'); endif; | |
| 48 | +?> | |
| 49 | +<p class="submit"> | |
| 50 | +<input class="button-primary" type="submit" name="submit" value="<?php print $caption; ?>" /> | |
| 51 | +</p> | |
| 52 | +<?php | |
| 53 | + endif; | |
| 54 | +} | |
| 55 | + | |
| 56 | +function fwp_authors_single_submit ($link = NULL) { | |
| 57 | + global $wp_db_version; | |
| 58 | + | |
| 59 | + if (fwp_test_wp_version(FWP_SCHEMA_25)) : | |
| 60 | +?> | |
| 61 | +<div class="submitbox" id="submitlink"> | |
| 62 | +<div id="previewview"> | |
| 63 | +</div> | |
| 64 | +<div class="inside"> | |
| 65 | +</div> | |
| 66 | + | |
| 67 | +<p class="submit"> | |
| 68 | +<input type="submit" name="save" value="<?php _e('Save') ?>" /> | |
| 69 | +</p> | |
| 70 | +</div> | |
| 71 | +<?php | |
| 72 | + endif; | |
| 73 | +} | |
| 74 | + | |
| 47 | 75 | function fwp_option_box_opener ($legend, $id, $class = "stuffbox") { |
| 48 | 76 | global $wp_db_version; |
| 49 | 77 | if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) : |
| 50 | 78 | ?> |
| @@ -89,9 +117,9 @@ | ||
| 89 | 117 | |
| 90 | 118 | function fwp_category_box ($checked, $object, $tags = array()) { |
| 91 | 119 | global $wp_db_version; |
| 92 | 120 | |
| 93 | - if (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_25) : // WordPress 2.5.x | |
| 121 | + if (fwp_test_wp_version(FWP_SCHEMA_25)) : // WordPress 2.5.x | |
| 94 | 122 | ?> |
| 95 | 123 | <div id="category-adder" class="wp-hidden-children"> |
| 96 | 124 | <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4> |
| 97 | 125 | <p id="category-add" class="wp-hidden-child"> |
| @@ -114,9 +142,9 @@ | ||
| 114 | 142 | <?php fwp_category_checklist(NULL, false, $checked) ?> |
| 115 | 143 | </ul> |
| 116 | 144 | </div> |
| 117 | 145 | <?php |
| 118 | - elseif (isset($wp_db_version) and $wp_db_version >= FWP_SCHEMA_20) : // WordPress 2.x | |
| 146 | + elseif (fwp_test_wp_version(FWP_SCHEMA_20)) : // WordPress 2.x | |
| 119 | 147 | ?> |
| 120 | 148 | <div id="moremeta"> |
| 121 | 149 | <div id="grabit" class="dbx-group"> |
| 122 | 150 | <fieldset id="categorydiv" class="dbx-box"> |
| @@ -123,9 +151,10 @@ | ||
| 123 | 151 | <h3 class="dbx-handle"><?php _e('Categories') ?></h3> |
| 124 | 152 | <div class="dbx-content"> |
| 125 | 153 | <p style="font-size:smaller;font-style:bold;margin:0">Place <?php print $object; ?> under...</p> |
| 126 | 154 | <p id="jaxcat"></p> |
| 127 | - <ul id="categorychecklist"><?php fwp_category_checklist(NULL, false, $checked); ?></ul></div> | |
| 155 | + <div id="categorychecklist"><?php fwp_category_checklist(NULL, false, $checked); ?></div> | |
| 156 | + </div> | |
| 128 | 157 | </fieldset> |
| 129 | 158 | </div> |
| 130 | 159 | </div> |
| 131 | 160 | <?php |
| @@ -130,12 +159,12 @@ | ||
| 130 | 159 | </div> |
| 131 | 160 | <?php |
| 132 | 161 | else : // WordPress 1.5 |
| 133 | 162 | ?> |
| 134 | - <fieldset id="categorydiv" style="width: 20%; margin-right: 2em"> | |
| 163 | + <fieldset style="width: 60%;"> | |
| 135 | 164 | <legend><?php _e('Categories') ?></legend> |
| 136 | 165 | <p style="font-size:smaller;font-style:bold;margin:0">Place <?php print $object; ?> under...</p> |
| 137 | - <div style="height: 20em"><?php fwp_category_checklist(NULL, false, $checked); ?></div> | |
| 166 | + <div style="height: 10em; overflow: scroll;"><?php fwp_category_checklist(NULL, false, $checked); ?></div> | |
| 138 | 167 | </fieldset> |
| 139 | 168 | <?php |
| 140 | 169 | endif; |
| 141 | 170 | } |
| @@ -141,20 +170,34 @@ | ||
| 141 | 170 | } |
| 142 | 171 | |
| 143 | 172 | function update_feeds_mention ($feed) { |
| 144 | 173 | echo "<li>Updating <cite>".$feed['link/name']."</cite> from <<a href=\"" |
| 145 | - .$feed['link/uri']."\">".$feed['link/uri']."</a>> ...</li>\n"; | |
| 174 | + .$feed['link/uri']."\">".$feed['link/uri']."</a>> ..."; | |
| 146 | 175 | flush(); |
| 147 | 176 | } |
| 177 | +function update_feeds_finish ($feed, $added, $dt) { | |
| 178 | + echo " completed in $dt second".(($dt==1)?'':'s')."</li>\n"; | |
| 179 | +} | |
| 148 | 180 | |
| 149 | 181 | function fwp_author_list () { |
| 150 | 182 | global $wpdb; |
| 151 | 183 | $ret = array(); |
| 152 | - $users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY display_name"); | |
| 184 | + | |
| 185 | + // display_name introduced in WP 2.0 | |
| 186 | + if (fwp_test_wp_version(FWP_SCHEMA_20)) : | |
| 187 | + $name_column = 'display_name'; | |
| 188 | + else : | |
| 189 | + $name_column = 'user_nickname'; | |
| 190 | + endif; | |
| 191 | + | |
| 192 | + $users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY {$name_column}"); | |
| 153 | 193 | if (is_array($users)) : |
| 154 | 194 | foreach ($users as $user) : |
| 155 | 195 | $id = (int) $user->ID; |
| 156 | - $ret[$id] = $user->display_name; | |
| 196 | + $ret[$id] = $user->{$name_column}; | |
| 197 | + if (strlen(trim($ret[$id])) == 0) : | |
| 198 | + $ret[$id] = $user->user_login; | |
| 199 | + endif; | |
| 157 | 200 | endforeach; |
| 158 | 201 | endif; |
| 159 | 202 | return $ret; |
| 160 | 203 | } |