| @@ -745,40 +745,70 @@ | ||
| 745 | 745 | endif; |
| 746 | 746 | } |
| 747 | 747 | |
| 748 | 748 | function fwp_tags_box ($tags, $object, $params = array()) { |
| 749 | + $params = wp_parse_args($params, array( // Default values | |
| 750 | + 'taxonomy' => 'post_tag', | |
| 751 | + 'textarea_name' => NULL, | |
| 752 | + 'textarea_id' => NULL, | |
| 753 | + 'input_id' => NULL, | |
| 754 | + 'input_name' => NULL, | |
| 755 | + 'id' => NULL, | |
| 756 | + 'box_title' => __('Post Tags'), | |
| 757 | + )); | |
| 758 | + | |
| 749 | 759 | if (!is_array($tags)) : $tags = array(); endif; |
| 750 | - $tax_name = (isset($params['taxonomy']) ? $params['taxonomy'] : 'post_tag'); | |
| 760 | + | |
| 761 | + $tax_name = $params['taxonomy']; | |
| 762 | + $taxonomy = get_taxonomy($params['taxonomy']); | |
| 763 | + $disabled = (!current_user_can($taxonomy->cap->assign_terms) ? 'disabled="disabled"' : ''); | |
| 764 | + | |
| 751 | 765 | $desc = "<p style=\"font-size:smaller;font-style:bold;margin:0\">Tag $object as...</p>"; |
| 752 | 766 | |
| 753 | - if (isset($params['textarea_name'])) : | |
| 754 | - $textAreaName = $params['textarea_name']; | |
| 755 | - else : | |
| 756 | - $textAreaName = "tax_input[$tax_name]"; | |
| 767 | + if (is_null($params['textarea_name'])) : | |
| 768 | + $params['textarea_name'] = "tax_input[$tax_name]"; | |
| 757 | 769 | endif; |
| 770 | + if (is_null($params['textarea_id'])) : | |
| 771 | + $params['textarea_id'] = "tax-input-${tax_name}"; | |
| 772 | + endif; | |
| 773 | + if (is_null($params['input_id'])) : | |
| 774 | + $params['input_id'] = "new-tag-${tax_name}"; | |
| 775 | + endif; | |
| 776 | + if (is_null($params['input_name'])) : | |
| 777 | + $params['input_name'] = "newtag[$tax_name]"; | |
| 778 | + endif; | |
| 779 | + | |
| 780 | + if (is_null($params['id'])) : | |
| 781 | + $params['id'] = $tax_name; | |
| 782 | + endif; | |
| 783 | + | |
| 758 | 784 | print $desc; |
| 759 | 785 | $helps = __('Separate tags with commas.'); |
| 760 | 786 | $box['title'] = __('Tags'); |
| 761 | 787 | ?> |
| 762 | - <div class="tagsdiv" id="<?php echo $tax_name; ?>"> | |
| 763 | - <div class="jaxtag"> | |
| 764 | - <div class="nojs-tags hide-if-js"> | |
| 765 | - <p><?php _e('Add or remove tags'); ?></p> | |
| 766 | - <textarea name="<?php echo esc_html($textAreaName); ?>" class="the-tags" id="tax-input[<?php echo $tax_name; ?>]"><?php echo esc_attr(implode(",", $tags)); ?></textarea></div> | |
| 788 | +<div class="tagsdiv" id="<?php echo $params['id']; ?>"> | |
| 789 | + <div class="jaxtag"> | |
| 790 | + <div class="nojs-tags hide-if-js"> | |
| 791 | + <p><?php echo $taxonomy->labels->add_or_remove_items; ?></p> | |
| 792 | + <textarea name="<?php echo $params['textarea_name']; ?>" class="the-tags" id="<?php echo $params['textarea_id']; ?>"><?php echo esc_attr(implode(",", $tags)); ?></textarea></div> | |
| 767 | 793 | |
| 768 | - <div class="ajaxtag hide-if-no-js"> | |
| 769 | - <label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label> | |
| 770 | - <div class="taghint"><?php _e('Add new tag'); ?></div> | |
| 771 | - <p> | |
| 772 | - <input type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="" /> | |
| 773 | - <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" tabindex="3" /> | |
| 774 | - </p> | |
| 775 | - </div></div> | |
| 776 | - <p class="howto"><?php echo $helps; ?></p> | |
| 777 | - <div class="tagchecklist"></div> | |
| 778 | - </div> | |
| 779 | - <p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php printf( __('Choose from the most used tags in %s'), $box['title'] ); ?></a></p> | |
| 780 | - <?php | |
| 794 | + <?php if ( current_user_can($taxonomy->cap->assign_terms) ) :?> | |
| 795 | + <div class="ajaxtag hide-if-no-js"> | |
| 796 | + <label class="screen-reader-text" for="<?php echo $params['input_id']; ?>"><?php echo $params['box_title']; ?></label> | |
| 797 | + <div class="taghint"><?php echo $taxonomy->labels->add_new_item; ?></div> | |
| 798 | + <p><input type="text" id="<?php print $params['input_id']; ?>" name="<?php print $params['input_name']; ?>" class="newtag form-input-tip" size="16" autocomplete="off" value="" /> | |
| 799 | + <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" tabindex="3" /></p> | |
| 800 | + </div> | |
| 801 | + <p class="howto"><?php echo esc_attr( $taxonomy->labels->separate_items_with_commas ); ?></p> | |
| 802 | + <?php endif; ?> | |
| 803 | + </div> | |
| 804 | + | |
| 805 | + <div class="tagchecklist"></div> | |
| 806 | +</div> | |
| 807 | +<?php if ( current_user_can($taxonomy->cap->assign_terms) ) : ?> | |
| 808 | +<p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->choose_from_most_used; ?></a></p> | |
| 809 | +<?php endif; | |
| 810 | + | |
| 781 | 811 | } |
| 782 | 812 | |
| 783 | 813 | function fwp_category_box ($checked, $object, $tags = array(), $params = array()) { |
| 784 | 814 | global $wp_db_version; |
| @@ -1081,9 +1111,9 @@ | ||
| 1081 | 1111 | |
| 1082 | 1112 | // Prep: Get last updated timestamp |
| 1083 | 1113 | $sLink = new SyndicatedLink($link->link_id); |
| 1084 | 1114 | if (!is_null($sLink->setting('update/last'))) : |
| 1085 | - $lastUpdated = fwp_time_elapsed($sLink->setting('update/last')); | |
| 1115 | + $lastUpdated = 'Last checked '. fwp_time_elapsed($sLink->setting('update/last')); | |
| 1086 | 1116 | else : |
| 1087 | 1117 | $lastUpdated = __('None yet'); |
| 1088 | 1118 | endif; |
| 1089 | 1119 | |
| @@ -1106,21 +1136,43 @@ | ||
| 1106 | 1136 | ."</code></p>" |
| 1107 | 1137 | ."</div>\n"; |
| 1108 | 1138 | endif; |
| 1109 | 1139 | |
| 1110 | - $nextUpdate = "<div style='font-style:italic;size:0.9em'>Ready for next update "; | |
| 1111 | - if (isset($sLink->settings['update/ttl']) and is_numeric($sLink->settings['update/ttl'])) : | |
| 1112 | - if (isset($sLink->settings['update/timed']) and $sLink->settings['update/timed']=='automatically') : | |
| 1113 | - $next = $sLink->settings['update/last'] + ((int) $sLink->settings['update/ttl'] * 60); | |
| 1140 | + $nextUpdate = "<div style='max-width: 30.0em; font-size: 0.9em;'><div style='font-style:italic;'>"; | |
| 1141 | + | |
| 1142 | + $ttl = $sLink->setting('update/ttl'); | |
| 1143 | + if (is_numeric($ttl)) : | |
| 1144 | + $next = $sLink->setting('update/last') + $sLink->setting('update/fudge') + ((int) $ttl * 60); | |
| 1145 | + if ('automatically'==$sLink->setting('update/timed')) : | |
| 1146 | + if ($next < time()) : | |
| 1147 | + $nextUpdate .= 'Ready and waiting to be updated since '; | |
| 1148 | + else : | |
| 1149 | + $nextUpdate .= 'Scheduled for next update '; | |
| 1150 | + endif; | |
| 1114 | 1151 | $nextUpdate .= fwp_time_elapsed($next); |
| 1115 | 1152 | if (FEEDWORDPRESS_DEBUG) : $nextUpdate .= " [".(($next-time())/60)." minutes]"; endif; |
| 1116 | 1153 | else : |
| 1117 | - $nextUpdate .= "every ".$sLink->settings['update/ttl']." minute".(($sLink->settings['update/ttl']!=1)?"s":""); | |
| 1154 | + $lastUpdated .= " · Next "; | |
| 1155 | + if ($next < time()) : | |
| 1156 | + $lastUpdated .= 'ASAP'; | |
| 1157 | + elseif ($next - time() < 60) : | |
| 1158 | + $lastUpdated .= fwp_time_elapsed($next); | |
| 1159 | + elseif ($next - time() < 60*60*24) : | |
| 1160 | + $lastUpdated .= gmdate('g:ia', $next + (get_option('gmt_offset') * 3600)); | |
| 1161 | + else : | |
| 1162 | + $lastUpdated .= gmdate('F j', $next + (get_option('gmt_offset') * 3600)); | |
| 1163 | + endif; | |
| 1164 | + | |
| 1165 | + $nextUpdate .= "Scheduled to be checked for updates every ".$ttl." minute".(($ttl!=1)?"s":"")."</div><div style='size:0.9em; margin-top: 0.5em'> This update schedule was requested by the feed provider"; | |
| 1166 | + if ($sLink->setting('update/xml')) : | |
| 1167 | + $nextUpdate .= " using a standard <code style=\"font-size: inherit; padding: 0; background: transparent\"><".$sLink->setting('update/xml')."></code> element"; | |
| 1168 | + endif; | |
| 1169 | + $nextUpdate .= "."; | |
| 1118 | 1170 | endif; |
| 1119 | 1171 | else: |
| 1120 | - $nextUpdate .= "as soon as possible"; | |
| 1172 | + $nextUpdate .= "Scheduled for update as soon as possible"; | |
| 1121 | 1173 | endif; |
| 1122 | - $nextUpdate .= "</div>"; | |
| 1174 | + $nextUpdate .= "</div></div>"; | |
| 1123 | 1175 | |
| 1124 | 1176 | unset($sLink); |
| 1125 | 1177 | |
| 1126 | 1178 | $alt_row = !$alt_row; |