Changeset 10108 for trunk/src/bp-core/bp-core-functions.php
- Timestamp:
- 09/13/2015 02:02:56 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-functions.php
r10046 r10108 1 1 <?php 2 3 2 /** 4 3 * BuddyPress Common Functions. … … 8 7 */ 9 8 10 // Exit if accessed directly 9 // Exit if accessed directly. 11 10 defined( 'ABSPATH' ) || exit; 12 11 … … 16 15 * Output the BuddyPress version. 17 16 * 18 * @since BuddyPress (1.6.0)17 * @since 1.6.0 19 18 * 20 19 * @uses bp_get_version() To get the BuddyPress version. … … 26 25 * Return the BuddyPress version. 27 26 * 28 * @since BuddyPress (1.6.0)27 * @since 1.6.0 29 28 * 30 29 * @return string The BuddyPress version. … … 37 36 * Output the BuddyPress database version. 38 37 * 39 * @since BuddyPress (1.6.0)38 * @since 1.6.0 40 39 * 41 40 * @uses bp_get_db_version() To get the BuddyPress database version. … … 47 46 * Return the BuddyPress database version. 48 47 * 49 * @since BuddyPress (1.6.0)48 * @since 1.6.0 50 49 * @return string The BuddyPress database version. 51 50 */ … … 57 56 * Output the BuddyPress database version. 58 57 * 59 * @since BuddyPress (1.6.0)58 * @since 1.6.0 60 59 * 61 60 * @uses bp_get_db_version_raw() To get the current database BuddyPress version. … … 67 66 * Return the BuddyPress database version. 68 67 * 69 * @since BuddyPress (1.6)68 * @since 1.6.0 70 69 * 71 70 * @return string The BuddyPress version direct from the database. … … 95 94 * Intended primarily for use in multinetwork installations. 96 95 * 97 * @since BuddyPress (1.2.6)96 * @since 1.2.6 98 97 * 99 98 * @param string $base_prefix Base prefix to use. … … 108 107 * your own awkward callback function for usort(). 109 108 * 110 * @since BuddyPress (2.2.0)109 * @since 2.2.0 111 110 * 112 111 * @param array $items The items to be sorted. Its constituent items can be either associative arrays or objects. … … 157 156 * $sorted_posts = bp_alpha_sort_by_key( $posts, 'post_name' ); 158 157 * 159 * @since BuddyPress (1.9.0)158 * @since 1.9.0 160 159 * 161 160 * @param array $items The items to be sorted. Its constituent items can be either associative arrays or objects. … … 185 184 * Filters the BuddyPress formatted number. 186 185 * 187 * @since BuddyPress (1.2.4)186 * @since 1.2.4 188 187 * 189 188 * @param string $value BuddyPress formatted value. … … 224 223 * For the second argument, $func_args, you should just pass the value of func_get_args(). 225 224 * 226 * @since BuddyPress (1.6)225 * @since 1.6.0 227 226 * 228 227 * @param array $old_args_keys Old argument indexs, keyed to their positions. … … 252 251 * are applied. 253 252 * 254 * @since BuddyPress (r7704)253 * @since r7704 255 254 * 256 255 * @param string|array $args Value to merge with $defaults. … … 279 278 * This is a dynamic filter dependent on the specified key. 280 279 * 281 * @since BuddyPress (2.0.0)280 * @since 2.0.0 282 281 * 283 282 * @param array $r Array of arguments to use. … … 299 298 * This is a dynamic filter dependent on the specified key. 300 299 * 301 * @since BuddyPress (2.0.0)300 * @since 2.0.0 302 301 * 303 302 * @param array $r Array of parsed arguments. … … 315 314 * responsible for limiting the resultset of a template loop. 316 315 * 317 * @since BuddyPress (2.2.0)316 * @since 2.2.0 318 317 * 319 318 * @param string $page_arg The $_REQUEST argument to look for. … … 346 345 * Everything else becomes 'ASC'. 347 346 * 348 * @since BuddyPress (1.8.0)347 * @since 1.8.0 349 348 * 350 349 * @param string $order The 'order' string, as passed to the SQL constructor. … … 365 364 * logic of the replacement, wpdb::esc_like(). 366 365 * 367 * @since BuddyPress (2.1.0)366 * @since 2.1.0 368 367 * 369 368 * @see wpdb::esc_like() for more details on proper use. … … 387 386 * Are we running username compatibility mode? 388 387 * 389 * @since BuddyPress (1.5.0)388 * @since 1.5.0 390 389 * 391 390 * @uses apply_filters() Filter 'bp_is_username_compatibility_mode' to alter. … … 400 399 * Filters whether or not to use username compatibility mode. 401 400 * 402 * @since BuddyPress (1.5.0)401 * @since 1.5.0 403 402 * 404 403 * @param bool $value Whether or not username compatibility mode should be used. … … 413 412 * of BP 1.5. For BP 1.6, the WP Toolbar is the default. 414 413 * 415 * @since BuddyPress (1.5.0)414 * @since 1.5.0 416 415 * 417 416 * @uses apply_filters() Filter 'bp_use_wp_admin_bar' to alter. … … 436 435 * Filters whether or not to use the admin bar. 437 436 * 438 * @since BuddyPress (1.5.0)437 * @since 1.5.0 439 438 * 440 439 * @param bool $use_admin_bar Whether or not to use the admin bar. … … 448 447 * Returns an array of core component IDs. 449 448 * 450 * @since BuddyPress (2.1.0)449 * @since 2.1.0 451 450 * 452 451 * @return array … … 477 476 * Fetch a list of BP directory pages from the appropriate meta table. 478 477 * 479 * @since BuddyPress (1.5.0)478 * @since 1.5.0 480 479 * 481 480 * @param string $status 'active' to return only pages associated with active components, 'all' to return all saved … … 517 516 * Filters the list of BP directory pages from the appropriate meta table. 518 517 * 519 * @since BuddyPress (1.5.0)518 * @since 1.5.0 520 519 * 521 520 * @param array $page_ids Array of directory pages. … … 531 530 * bp_get_root_blog_id() and go through the setup process again. 532 531 * 533 * @since BuddyPress (1.5.0)532 * @since 1.5.0 534 533 * 535 534 * @param array $blog_page_ids The IDs of the WP pages corresponding to BP … … 543 542 * Get names and slugs for BuddyPress component directory pages. 544 543 * 545 * @since BuddyPress (1.5.0).544 * @since 1.5.0 546 545 * 547 546 * @return object Page names, IDs, and slugs. … … 601 600 * Filters the names and slugs for BuddyPress component directory pages. 602 601 * 603 * @since BuddyPress (1.5.0)602 * @since 1.5.0 604 603 * 605 604 * @param object $pages Object holding page names and slugs. … … 614 613 * content (eg, the 'groups' page created by BP). 615 614 * 616 * @since BuddyPress (1.7.0)615 * @since 1.7.0 617 616 * 618 617 * @param array $components Components to create pages for. … … 714 713 * @link https://buddypress.trac.wordpress.org/ticket/6226 715 714 * 716 * @since BuddyPress (2.2.0)715 * @since 2.2.0 717 716 * 718 717 * @param int $post_id Post ID. … … 754 753 * BP_MEMBERS_SLUG) to override specific component slugs. 755 754 * 756 * @since BuddyPress (1.5.0)755 * @since 1.5.0 757 756 * 758 757 * @param string $root_slug The root slug, which comes from $bp->pages->[component]->slug. … … 767 766 * Filters the default component slug from a WP page root_slug. 768 767 * 769 * @since BuddyPress (1.5.0)768 * @since 1.5.0 770 769 * 771 770 * @param string $slug Short slug for use in the middle of URLs. … … 858 857 * Determine whether BuddyPress should register the bp-themes directory. 859 858 * 860 * @since BuddyPress (1.9.0)859 * @since 1.9.0 861 860 * 862 861 * @return bool True if bp-themes should be registered, false otherwise. … … 885 884 * Filters whether BuddyPress should register the bp-themes directory. 886 885 * 887 * @since BuddyPress (1.9.0)886 * @since 1.9.0 888 887 * 889 888 * @param bool $register If bp-themes should be registered. … … 910 909 * Filters the domain for the root blog. 911 910 * 912 * @since BuddyPress (1.0.1)911 * @since 1.0.1 913 912 * 914 913 * @param string $domain The domain URL for the blog. … … 950 949 * reduced to '/foo/'. 951 950 * 952 * @since BuddyPress (2.3.0)951 * @since 2.3.0 953 952 * 954 953 * @return bool|string Returns false on error, a URL path on success. … … 1001 1000 * Filters the path of the current site. 1002 1001 * 1003 * @since BuddyPress (1.2.0)1002 * @since 1.2.0 1004 1003 * 1005 1004 * @param string $site_path URL to the current site. … … 1013 1012 * Get the current GMT time to save into the DB. 1014 1013 * 1015 * @since BuddyPress (1.2.6)1014 * @since 1.2.6 1016 1015 * 1017 1016 * @param bool $gmt True to use GMT (rather than local) time. Default: true. … … 1026 1025 * Filters the current GMT time to save into the DB. 1027 1026 * 1028 * @since BuddyPress (1.2.6)1027 * @since 1.2.6 1029 1028 * 1030 1029 * @param string $value Current GMT time. … … 1065 1064 * Filters whether or not to bypass BuddyPress' time_since calculations. 1066 1065 * 1067 * @since BuddyPress (1.7.0)1066 * @since 1.7.0 1068 1067 * 1069 1068 * @param bool $value Whether or not to bypass. … … 1079 1078 * Filters the value to use if the time since is unknown. 1080 1079 * 1081 * @since BuddyPress (1.5.0)1080 * @since 1.5.0 1082 1081 * 1083 1082 * @param string $value String representing the time since the older date. … … 1088 1087 * Filters the value to use if the time since is right now. 1089 1088 * 1090 * @since BuddyPress (1.5.0)1089 * @since 1.5.0 1091 1090 * 1092 1091 * @param string $value String representing the time since the older date. … … 1097 1096 * Filters the value to use if the time since is some time ago. 1098 1097 * 1099 * @since BuddyPress (1.5.0)1098 * @since 1.5.0 1100 1099 * 1101 1100 * @param string $value String representing the time since the older date. … … 1234 1233 * Filters the English-language representation of the time elapsed since a given date. 1235 1234 * 1236 * @since BuddyPress (1.7.0)1235 * @since 1.7.0 1237 1236 * 1238 1237 * @param string $output Final 'time since' string. … … 1328 1327 * Filters the 'template_notices' feedback message content. 1329 1328 * 1330 * @since BuddyPress (1.5.5)1329 * @since 1.5.5 1331 1330 * 1332 1331 * @param string $template_message Feedback message content. … … 1347 1346 * Fires after the display of any template_notices feedback messages. 1348 1347 * 1349 * @since BuddyPress (1.1.0)1348 * @since 1.1.0 1350 1349 */ 1351 1350 do_action( 'bp_core_render_message' ); … … 1403 1402 * Use this action to detect the very first activity for a given member. 1404 1403 * 1405 * @since BuddyPress (1.6.0)1404 * @since 1.6.0 1406 1405 * 1407 1406 * @param int $user_id ID of the user whose activity is recorded. … … 1443 1442 * Filters last activity string based on time since date given. 1444 1443 * 1445 * @since BuddyPress (1.2.0)1444 * @since 1.2.0 1446 1445 * 1447 1446 * @param string $last_active Last activity string based on time since date given. … … 1470 1469 * If using the WP functions, do not not hardcode your meta keys. 1471 1470 * 1472 * @since BuddyPress (1.5.0)1471 * @since 1.5.0 1473 1472 * 1474 1473 * @uses apply_filters() Filter 'bp_get_user_meta_key' to modify keys individually. … … 1483 1482 * Filters the meta_key for a given piece of user metadata. 1484 1483 * 1485 * @since BuddyPress (1.5.0)1484 * @since 1.5.0 1486 1485 * 1487 1486 * @param string $key The usermeta meta key. … … 1497 1496 * BP setups. 1498 1497 * 1499 * @since BuddyPress (1.5.0)1498 * @since 1.5.0 1500 1499 * 1501 1500 * @see get_user_meta() For complete details about parameters and return values. … … 1520 1519 * BP setups. 1521 1520 * 1522 * @since BuddyPress (1.5.0)1521 * @since 1.5.0 1523 1522 * 1524 1523 * @see update_user_meta() For complete details about parameters and return values. … … 1543 1542 * BP setups. 1544 1543 * 1545 * @since BuddyPress (1.5.0)1544 * @since 1.5.0 1546 1545 * 1547 1546 * @see delete_user_meta() For complete details about parameters and return values. … … 1563 1562 * Initializes {@link BP_Embed} after everything is loaded. 1564 1563 * 1565 * @since BuddyPress (1.5.0)1564 * @since 1.5.0 1566 1565 */ 1567 1566 function bp_embed_init() { … … 1579 1578 * Are oembeds allowed in activity items? 1580 1579 * 1581 * @since BuddyPress (1.5.0)1580 * @since 1.5.0 1582 1581 * 1583 1582 * @return bool False when activity embed support is disabled; true when … … 1589 1588 * Filters whether or not oEmbeds are allowed in activity items. 1590 1589 * 1591 * @since BuddyPress (1.5.0)1590 * @since 1.5.0 1592 1591 * 1593 1592 * @param bool $value Whether or not oEmbeds are allowed. … … 1599 1598 * Are oembeds allowed in activity replies? 1600 1599 * 1601 * @since BuddyPress (1.5.0)1600 * @since 1.5.0 1602 1601 * 1603 1602 * @return bool False when activity replies embed support is disabled; true … … 1609 1608 * Filters whether or not oEmbeds are allowed in activity replies. 1610 1609 * 1611 * @since BuddyPress (1.5.0)1610 * @since 1.5.0 1612 1611 * 1613 1612 * @param bool $value Whether or not oEmbeds are allowed. … … 1619 1618 * Are oembeds allowed in forum posts? 1620 1619 * 1621 * @since BuddyPress (1.5.0)1620 * @since 1.5.0 1622 1621 * 1623 1622 * @return bool False when forum post embed support is disabled; true when … … 1629 1628 * Filters whether or not oEmbeds are allowed in forum posts. 1630 1629 * 1631 * @since BuddyPress (1.5.0)1630 * @since 1.5.0 1632 1631 * 1633 1632 * @param bool $value Whether or not oEmbeds are allowed. … … 1639 1638 * Are oembeds allowed in private messages? 1640 1639 * 1641 * @since BuddyPress (1.5.0)1640 * @since 1.5.0 1642 1641 * 1643 1642 * @return bool False when private message embed support is disabled; true when … … 1649 1648 * Filters whether or not oEmbeds are allowed in private messages. 1650 1649 * 1651 * @since BuddyPress (1.5.0)1650 * @since 1.5.0 1652 1651 * 1653 1652 * @param bool $value Whether or not oEmbeds are allowed. … … 1661 1660 * Output the correct admin URL based on BuddyPress and WordPress configuration. 1662 1661 * 1663 * @since BuddyPress (1.5.0)1662 * @since 1.5.0 1664 1663 * 1665 1664 * @see bp_get_admin_url() For description of parameters. … … 1674 1673 * Return the correct admin URL based on BuddyPress and WordPress configuration. 1675 1674 * 1676 * @since BuddyPress (1.5.0)1675 * @since 1.5.0 1677 1676 * 1678 1677 * @uses bp_core_do_network_admin() … … 1709 1708 * to hook into certain areas of WordPress's admin. 1710 1709 * 1711 * @since BuddyPress (1.5.0)1710 * @since 1.5.0 1712 1711 * 1713 1712 * @uses bp_is_network_activated() … … 1729 1728 * Filters whether or not BuddyPress should appear in network admin. 1730 1729 * 1731 * @since BuddyPress (1.5.0)1730 * @since 1.5.0 1732 1731 * 1733 1732 * @param bool $retval Whether or not BuddyPress should be in the network admin. … … 1754 1753 * Filters the action name that BuddyPress nav setup callbacks should be hooked to. 1755 1754 * 1756 * @since BuddyPress (1.5.0)1755 * @since 1.5.0 1757 1756 * 1758 1757 * @param string $hook Action name to be attached to. … … 1766 1765 * Is this the root blog? 1767 1766 * 1768 * @since BuddyPress (1.5.0)1767 * @since 1.5.0 1769 1768 * 1770 1769 * @param int $blog_id Optional. Default: the ID of the current blog. … … 1790 1789 * Filters whether or not we're on the root blog. 1791 1790 * 1792 * @since BuddyPress (1.5.0)1791 * @since 1.5.0 1793 1792 * 1794 1793 * @param bool $is_root_blog Whether or not we're on the root blog. … … 1804 1803 * etc.). 1805 1804 * 1806 * @since BuddyPress (1.5.0)1805 * @since 1.5.0 1807 1806 * 1808 1807 * @return int The root site ID. … … 1813 1812 * Filters the ID for the root blog. 1814 1813 * 1815 * @since BuddyPress (1.5.0)1814 * @since 1.5.0 1816 1815 * 1817 1816 * @param int $root_blog_id ID for the root blog. … … 1843 1842 * down this road unless you specifically need to. 1844 1843 * 1845 * @since BuddyPress (1.5.0)1844 * @since 1.5.0 1846 1845 * 1847 1846 * @uses apply_filters() Filter 'bp_is_multiblog_mode' to alter. … … 1870 1869 * Filters whether or not we're running in multiblog mode. 1871 1870 * 1872 * @since BuddyPress (1.5.0)1871 * @since 1.5.0 1873 1872 * 1874 1873 * @param bool $retval Whether or not we're running multiblog mode. … … 1885 1884 * 'bp_is_network_activated' and override the auto-determined value. 1886 1885 * 1887 * @since BuddyPress (1.7.0)1886 * @since 1.7.0 1888 1887 * 1889 1888 * @return bool True if BuddyPress is network activated. … … 1906 1905 * Filters whether or not we're active at the network level. 1907 1906 * 1908 * @since BuddyPress (1.7.0)1907 * @since 1.7.0 1909 1908 * 1910 1909 * @param bool $retval Whether or not we're network activated. … … 1931 1930 * Filters the "is_directory" global value. 1932 1931 * 1933 * @since BuddyPress (1.5.0)1932 * @since 1.5.0 1934 1933 * 1935 1934 * @param bool $is_directory Whether or not we're "is_directory". … … 1955 1954 * Filters the "is_item_admin" global value. 1956 1955 * 1957 * @since BuddyPress (1.5.0)1956 * @since 1.5.0 1958 1957 * 1959 1958 * @param bool $is_item_admin Whether or not we're "is_item_admin". … … 1979 1978 * Filters the "is_item_mod" global value. 1980 1979 * 1981 * @since BuddyPress (1.5.0)1980 * @since 1.5.0 1982 1981 * 1983 1982 * @param bool $is_item_mod Whether or not we're "is_item_mod". … … 1990 1989 * Trigger a 404. 1991 1990 * 1992 * @since BuddyPress (1.5.0)1991 * @since 1.5.0 1993 1992 * 1994 1993 * @global WP_Query $wp_query WordPress query object. … … 2003 2002 * Fires inside the triggering of a 404. 2004 2003 * 2005 * @since BuddyPress (1.5.0)2004 * @since 1.5.0 2006 2005 * 2007 2006 * @param string $redirect Redirect type used to determine if redirect_canonical … … 2026 2025 * To avoid security exploits within the theme. 2027 2026 * 2028 * @since BuddyPress (1.6.0)2027 * @since 1.6.0 2029 2028 * 2030 2029 * @uses do_action() Calls 'bp_verify_nonce_request' on $action. … … 2073 2072 * Useful for configurations like reverse proxying. 2074 2073 * 2075 * @since BuddyPress (1.9.0)2074 * @since 1.9.0 2076 2075 * 2077 2076 * @param string $requested_url The requested URL. … … 2090 2089 * Fires at the end of the nonce verification check. 2091 2090 * 2092 * @since BuddyPress (1.6.0)2091 * @since 1.6.0 2093 2092 * 2094 2093 * @param string $action Action nonce. … … 2105 2104 * Return true|false if this is a POST request. 2106 2105 * 2107 * @since BuddyPress (1.9.0)2106 * @since 1.9.0 2108 2107 * @return bool 2109 2108 */ … … 2115 2114 * Return true|false if this is a GET request. 2116 2115 * 2117 * @since BuddyPress (1.9.0)2116 * @since 1.9.0 2118 2117 * @return bool 2119 2118 */ … … 2138 2137 * Filters the locale to be loaded for the language files. 2139 2138 * 2140 * @since BuddyPress (1.0.2)2139 * @since 1.0.2 2141 2140 * 2142 2141 * @param string $value Current locale for the install. … … 2147 2146 * Filters the locations to load language files from. 2148 2147 * 2149 * @since BuddyPress (2.2.0)2148 * @since 2.2.0 2150 2149 * 2151 2150 * @param array $value Array of directories to check for language files in. … … 2233 2232 * Filters the constructed url for use with site searching. 2234 2233 * 2235 * @since BuddyPress (1.0.0)2234 * @since 1.0.0 2236 2235 * 2237 2236 * @param string $value URL for use with site searching. … … 2262 2261 * prevents additional, unnecessary queries from running. 2263 2262 * 2264 * @since BuddyPress (2.1.0)2263 * @since 2.1.0 2265 2264 */ 2266 2265 function bp_remove_adjacent_posts_rel_link() { … … 2289 2288 * logged-in user. 2290 2289 * 2291 * @since BuddyPress (1.9.0)2290 * @since 1.9.0 2292 2291 * 2293 2292 * @return mixed A URL or an array of dummy pages. … … 2359 2358 * menu. 2360 2359 * 2361 * @since BuddyPress (1.9.0)2360 * @since 1.9.0 2362 2361 * 2363 2362 * @return mixed A URL or an array of dummy pages. … … 2430 2429 * proper URL for a given nav item slug (such as 'login' or 'messages'). 2431 2430 * 2432 * @since BuddyPress (1.9.0)2431 * @since 1.9.0 2433 2432 * 2434 2433 * @param string $slug The slug of the nav item: login, register, or one of the … … 2456 2455 * for similar kinds of future requirements, or those implemented by third-party developers. 2457 2456 * 2458 * @since BuddyPress (2.1.0)2457 * @since 2.1.0 2459 2458 * 2460 2459 * @param array $args … … 2486 2485 * if you've built a custom suggestions service. 2487 2486 * 2488 * @since BuddyPress (2.1.0)2487 * @since 2.1.0 2489 2488 * 2490 2489 * @param string $value Custom class to use. Default: none. … … 2511 2510 * Filters the available type of at-mentions. 2512 2511 * 2513 * @since BuddyPress (2.1.0)2512 * @since 2.1.0 2514 2513 * 2515 2514 * @param array|WP_Error $retval Array of results or WP_Error object. … … 2528 2527 * once to get what we need. 2529 2528 * 2530 * @since BuddyPress (2.3.0)2529 * @since 2.3.0 2531 2530 * 2532 2531 * @uses is_multisite()
Note: See TracChangeset
for help on using the changeset viewer.