Changeset 5684 for trunk/bp-activity/bp-activity-template.php
- Timestamp:
- 02/09/2012 10:10:47 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity/bp-activity-template.php
r5639 r5684 210 210 211 211 function the_activity() { 212 global $activity;213 212 214 213 $this->in_the_loop = true; 215 $this->activity = $this->next_activity();214 $this->activity = $this->next_activity(); 216 215 217 216 if ( is_array( $this->activity ) ) … … 441 440 * @since 1.2.0 442 441 * 443 * @global object $bp BuddyPress global settings444 442 * @global object $activities_template {@link BP_Activity_Template} 445 443 * @uses bp_core_number_format() … … 448 446 */ 449 447 function bp_get_activity_pagination_count() { 450 global $ bp, $activities_template;448 global $activities_template; 451 449 452 450 $start_num = intval( ( $activities_template->pag_page - 1 ) * $activities_template->pag_num ) + 1; … … 566 564 */ 567 565 function bp_activities_title() { 568 global $bp_activity_title;569 570 566 echo bp_get_activities_title(); 571 567 } … … 595 591 */ 596 592 function bp_activities_no_activity() { 597 global $bp_activity_no_activity;598 599 593 echo bp_get_activities_no_activity(); 600 594 } … … 970 964 * @param array $args optional 971 965 * 972 * @global object $bp BuddyPress global settings973 966 * @global object $activities_template {@link BP_Activity_Template} 974 967 * @uses wp_parse_args() … … 982 975 */ 983 976 function bp_get_activity_secondary_avatar( $args = '' ) { 984 global $ bp, $activities_template;977 global $activities_template; 985 978 986 979 $defaults = array( … … 1159 1152 * @todo properly deprecate this function 1160 1153 * 1161 * @global object $activities_template {@link BP_Activity_Template}1162 1154 * @uses bp_get_activity_action() 1163 1155 * @uses bp_get_activity_content_body() … … 1167 1159 */ 1168 1160 function bp_get_activity_content() { 1169 global $activities_template;1170 1171 1161 /** 1172 1162 * If you want to filter activity update content, please use … … 1188 1178 * 1189 1179 * @global object $activities_template {@link BP_Activity_Template} 1190 * @global object $bp BuddyPress global settings1191 1180 * @uses bp_core_time_since() 1192 1181 * @uses apply_filters_ref_array() To call the 'bp_activity_time_since' hook … … 1200 1189 */ 1201 1190 function bp_insert_activity_meta( $content ) { 1202 global $activities_template , $bp;1191 global $activities_template; 1203 1192 1204 1193 // Strip any legacy time since placeholders from BP 1.0-1.1 … … 1225 1214 * 1226 1215 * @global object $activities_template {@link BP_Activity_Template} 1227 * @global object $bp BuddyPress global settings1228 1216 * @uses apply_filters() To call the 'bp_activity_user_can_delete' hook 1229 1217 * … … 1231 1219 */ 1232 1220 function bp_activity_user_can_delete( $activity = false ) { 1233 global $activities_template , $bp;1221 global $activities_template; 1234 1222 1235 1223 if ( !$activity ) … … 1247 1235 $can_delete = true; 1248 1236 1249 if ( $bp->is_item_admin && $bp->is_single_item)1237 if ( bp_is_item_admin() && bp_is_single_item() ) 1250 1238 $can_delete = true; 1251 1239 … … 1273 1261 * @param array $args Optional 1274 1262 * 1275 * @global object $bp BuddyPress global settings1276 1263 * @global object $activities_template {@link BP_Activity_Template} 1277 1264 * @uses wp_parse_args() … … 1281 1268 */ 1282 1269 function bp_get_activity_parent_content( $args = '' ) { 1283 global $ bp, $activities_template;1270 global $activities_template; 1284 1271 1285 1272 $defaults = array( … … 1328 1315 * @since 1.2.0 1329 1316 * 1330 * @global object $bp BuddyPress global settings1331 1317 * @global object $activities_template {@link BP_Activity_Template} 1332 1318 * @uses apply_filters() To call the 'bp_get_activity_is_favorite' hook … … 1335 1321 */ 1336 1322 function bp_get_activity_is_favorite() { 1337 global $ bp, $activities_template;1323 global $activities_template; 1338 1324 1339 1325 return apply_filters( 'bp_get_activity_is_favorite', in_array( $activities_template->activity->id, (array)$activities_template->my_favs ) ); … … 1366 1352 * 1367 1353 * @global object $activities_template {@link BP_Activity_Template} 1368 * @global object $bp BuddyPress global settings1369 1354 * @uses bp_activity_recurse_comments() 1370 1355 */ 1371 1356 function bp_activity_get_comments( $args = '' ) { 1372 global $activities_template , $bp;1357 global $activities_template; 1373 1358 1374 1359 if ( !isset( $activities_template->activity->children ) || !$activities_template->activity->children ) … … 1391 1376 * 1392 1377 * @global object $activities_template {@link BP_Activity_Template} 1393 * @global object $bp BuddyPress global settings1394 1378 * @uses locate_template() 1395 1379 */ 1396 1380 function bp_activity_recurse_comments( $comment ) { 1397 global $activities_template , $bp, $counter;1398 1399 if ( !$comment)1381 global $activities_template; 1382 1383 if ( empty( $comment ) ) 1400 1384 return false; 1401 1385 … … 1614 1598 * @since 1.5.0 1615 1599 * 1616 * @global object $bp BuddyPress global settings1617 1600 * @uses wp_nonce_url() 1618 1601 * @uses bp_get_root_domain() … … 1624 1607 */ 1625 1608 function bp_get_activity_comment_delete_link() { 1626 global $bp;1627 1628 1609 $link = wp_nonce_url( bp_get_root_domain() . '/' . bp_get_activity_slug() . '/delete/' . bp_get_activity_comment_id() . '?cid=' . bp_get_activity_comment_id(), 'bp_activity_delete_link' ); 1629 1610 … … 1688 1669 * 1689 1670 * @global object $activities_template {@link BP_Activity_Template} 1690 * @global object $bp BuddyPress global settings1691 1671 * @uses bp_activity_recurse_comment_count() 1692 1672 * @uses apply_filters() To call the 'bp_activity_get_comment_count' hook … … 1695 1675 */ 1696 1676 function bp_activity_get_comment_count( $args = '' ) { 1697 global $activities_template , $bp;1677 global $activities_template; 1698 1678 1699 1679 if ( !isset( $activities_template->activity->children ) || !$activities_template->activity->children ) … … 1718 1698 * @param object $comment Activity comments object 1719 1699 * 1720 * @global object $activities_template {@link BP_Activity_Template}1721 * @global object $bp BuddyPress global settings1722 1700 * @uses bp_activity_recurse_comment_count() 1723 1701 * @uses apply_filters() To call the 'bp_activity_get_comment_count' hook … … 1726 1704 */ 1727 1705 function bp_activity_recurse_comment_count( $comment, $count = 0 ) { 1728 global $activities_template, $bp; 1729 1730 if ( !$comment->children ) 1706 1707 if ( empty( $comment->children ) ) 1731 1708 return $count; 1732 1709 1733 foreach ( (array) $comment->children as $comment ) {1710 foreach ( (array) $comment->children as $comment ) { 1734 1711 $count++; 1735 1712 $count = bp_activity_recurse_comment_count( $comment, $count ); … … 1809 1786 * @since 1.2.0 1810 1787 * 1811 * @global object $bp BuddyPress global settings1812 1788 * @uses home_url() 1813 1789 * @uses bp_get_activity_root_slug() … … 1817 1793 */ 1818 1794 function bp_get_activity_comment_form_action() { 1819 global $bp;1820 1821 1795 return apply_filters( 'bp_get_activity_comment_form_action', home_url( bp_get_activity_root_slug() . '/reply/' ) ); 1822 1796 } … … 1865 1839 * @since 1.2.0 1866 1840 * 1867 * @global object $bp BuddyPress global settings1868 1841 * @uses bp_activity_get_permalink() 1869 1842 * @uses apply_filters() To call the 'bp_get_activity_thread_permalink' hook … … 1872 1845 */ 1873 1846 function bp_get_activity_thread_permalink() { 1874 global $ bp, $activities_template;1847 global $activities_template; 1875 1848 1876 1849 $link = bp_activity_get_permalink( $activities_template->activity->id, $activities_template->activity ); … … 1895 1868 * @since 1.2.0 1896 1869 * 1897 * @global object $bp BuddyPress global settings1898 1870 * @global object $activities_template {@link BP_Activity_Template} 1899 1871 * @uses wp_nonce_url() … … 1905 1877 */ 1906 1878 function bp_get_activity_favorite_link() { 1907 global $ bp, $activities_template;1879 global $activities_template; 1908 1880 return apply_filters( 'bp_get_activity_favorite_link', wp_nonce_url( home_url( bp_get_activity_root_slug() . '/favorite/' . $activities_template->activity->id . '/' ), 'mark_favorite' ) ); 1909 1881 } … … 1925 1897 * @since 1.2.0 1926 1898 * 1927 * @global object $bp BuddyPress global settings1928 1899 * @global object $activities_template {@link BP_Activity_Template} 1929 1900 * @uses wp_nonce_url() … … 1935 1906 */ 1936 1907 function bp_get_activity_unfavorite_link() { 1937 global $ bp, $activities_template;1908 global $activities_template; 1938 1909 return apply_filters( 'bp_get_activity_unfavorite_link', wp_nonce_url( home_url( bp_get_activity_root_slug() . '/unfavorite/' . $activities_template->activity->id . '/' ), 'unmark_favorite' ) ); 1939 1910 } … … 2002 1973 * 2003 1974 * @global object $activities_template {@link BP_Activity_Template} 2004 * @global object $bp BuddyPress global settings2005 1975 * @uses bp_get_root_domain() 2006 1976 * @uses bp_get_activity_root_slug() … … 2015 1985 */ 2016 1986 function bp_get_activity_delete_link() { 2017 global $activities_template , $bp;1987 global $activities_template; 2018 1988 2019 1989 $url = bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/delete/' . $activities_template->activity->id; … … 2050 2020 * @param int $user_id Defaults to 0 2051 2021 * 2052 * @global object $bp BuddyPress global settings2053 2022 * @uses bp_is_user_inactive() 2054 2023 * @uses bp_core_is_user_deleted() … … 2063 2032 */ 2064 2033 function bp_get_activity_latest_update( $user_id = 0 ) { 2065 global $bp; 2066 2067 if ( !$user_id ) 2034 2035 if ( empty( $user_id ) ) 2068 2036 $user_id = bp_displayed_user_id(); 2069 2037 … … 2100 2068 * @param array $args Defaults to false 2101 2069 * 2102 * @global object $activities_template {@link BP_Activity_Template}2103 * @global object $bp BuddyPress global settings2104 2070 * @uses wp_parse_args() 2105 2071 * @uses BP_Activity_Activity::get_recorded_components() {@link BP_Activity_Activity} … … 2113 2079 */ 2114 2080 function bp_get_activity_filter_links( $args = false ) { 2115 global $activities_template, $bp;2116 2081 2117 2082 $defaults = array( … … 2122 2087 extract( $r, EXTR_SKIP ); 2123 2088 2089 // Define local variable 2090 $component_links = array(); 2091 2124 2092 // Fetch the names of components that have activity recorded in the DB 2125 2093 $components = BP_Activity_Activity::get_recorded_components(); 2126 2094 2127 if ( !$components)2095 if ( empty( $components ) ) 2128 2096 return false; 2129 2097 2130 2098 foreach ( (array) $components as $component ) { 2131 /* Skip the activity comment filter */ 2099 2100 // Skip the activity comment filter 2132 2101 if ( 'activity' == $component ) 2133 2102 continue; … … 2160 2129 $link = add_query_arg( 'afilter', $component ); 2161 2130 $link = remove_query_arg( 'acpage' , $link ); 2162 2163 2131 $link = apply_filters( 'bp_get_activity_filter_link_href', $link, $component ); 2164 2132 2165 // Make sure all core internal component names are translatable 2166 $translatable_components = array( __( 'xprofile', 'buddypress'), __( 'friends', 'buddypress' ), __( 'groups', 'buddypress' ), __( 'status', 'buddypress' ), __( 'sites', 'buddypress' ) ); 2167 2168 $component_links[] = $before . '<a href="' . esc_attr( $link ) . '">' . ucwords( __( $component, 'buddypress' ) ) . '</a>' . $after; 2133 $component_links[] = $before . '<a href="' . esc_attr( $link ) . '">' . ucwords( $component ) . '</a>' . $after; 2169 2134 } 2170 2135 … … 2183 2148 * 2184 2149 * @global object $activities_template {@link BP_Activity_Template} 2185 * @global object $bp BuddyPress global settings2186 2150 * @uses bp_get_activity_action_name() 2187 2151 * @uses apply_filters() To call the 'bp_activity_can_comment' hook … … 2190 2154 */ 2191 2155 function bp_activity_can_comment() { 2192 global $activities_template , $bp;2156 global $activities_template; 2193 2157 2194 2158 $can_comment = true; … … 2284 2248 * @since 1.2.0 2285 2249 * 2286 * @todo remove unnecessary $bp global2287 *2288 2250 * @param int $user_id Defaults to 0 2289 *2290 2251 * @uses bp_get_user_meta() 2291 2252 * @uses apply_filters() To call the 'bp_get_total_mention_count_for_user' hook 2292 *2293 2253 * @return int The total mention count for a specified user 2294 2254 */ 2295 2255 function bp_get_total_mention_count_for_user( $user_id = 0 ) { 2296 global $bp;2297 2298 2256 return apply_filters( 'bp_get_total_mention_count_for_user', bp_get_user_meta( $user_id, 'bp_new_mention_count', true ) ); 2299 2257 } … … 2507 2465 */ 2508 2466 function bp_get_member_activity_feed_link() { 2509 global $bp;2510 2467 2511 2468 if ( bp_is_profile_component() || bp_is_current_action( 'just-me' ) ) … … 2515 2472 elseif ( bp_is_active( 'groups' ) && bp_is_current_action( bp_get_groups_slug() ) ) 2516 2473 $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/' . bp_get_groups_slug() . '/feed/'; 2517 elseif ( 'favorites' == $bp->current_action)2474 elseif ( 'favorites' == bp_current_action() ) 2518 2475 $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/favorites/feed/'; 2519 elseif ( 'mentions' == $bp->current_action)2476 elseif ( 'mentions' == bp_current_action() ) 2520 2477 $link = bp_displayed_user_domain() . bp_get_activity_slug() . '/mentions/feed/'; 2521 2478 else
Note: See TracChangeset
for help on using the changeset viewer.