Changeset 11903
- Timestamp:
- 03/19/2018 05:20:23 PM (8 years ago)
- Location:
- trunk/src/bp-templates/bp-nouveau/includes
- Files:
-
- 6 edited
-
activity/ajax.php (modified) (2 diffs)
-
ajax.php (modified) (1 diff)
-
blogs/ajax.php (modified) (2 diffs)
-
friends/ajax.php (modified) (2 diffs)
-
groups/ajax.php (modified) (1 diff)
-
messages/ajax.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-templates/bp-nouveau/includes/activity/ajax.php
r11899 r11903 9 9 defined( 'ABSPATH' ) || exit; 10 10 11 /** 12 * Registers activity AJAX actions. 13 * @todo this funciton CANNOT be run when the file is included (like it is now). Move to a function and hook to something. 14 */ 15 bp_nouveau_register_ajax_actions( 16 array( 11 add_action( 'admin_init', function() { 12 $ajax_actions = array( 17 13 array( 18 14 'activity_filter' => array( … … 75 71 ), 76 72 ), 77 ) 78 ); 73 ); 74 75 foreach ( $ajax_actions as $ajax_action ) { 76 $action = key( $ajax_action ); 77 78 add_action( 'wp_ajax_' . $action, $ajax_action[ $action ]['function'] ); 79 80 if ( ! empty( $ajax_action[ $action ]['nopriv'] ) ) { 81 add_action( 'wp_ajax_nopriv_' . $action, $ajax_action[ $action ]['function'] ); 82 } 83 } 84 }, 12 ); 79 85 80 86 /** -
trunk/src/bp-templates/bp-nouveau/includes/ajax.php
r11901 r11903 123 123 wp_send_json_success( $result ); 124 124 } 125 126 /**127 * Register AJAX hooks.128 *129 * @since 3.0.0130 *131 * @param array $ajax_actions {132 * Optional. Multi-dimensional array. For example:133 *134 * $ajax_actions = array(135 * array( 'messages_send_message' => array( 'function' => 'bp_nouveau_ajax_messages_send_message', 'nopriv' => false ) ),136 * array( 'messages_send_reply' => array( 'function' => 'bp_nouveau_ajax_messages_send_reply', 'nopriv' => false ) ),137 * );138 *139 * - 'messages_send_message' is the AJAX action.140 * - 'bp_nouveau_ajax_messages_send_message' is the hooked function to the AJAX action.141 * - 'nopriv' indicates whether the AJAX action is allowed for logged-out users.142 * }143 *144 * @return array145 */146 function bp_nouveau_register_ajax_actions( $ajax_actions = array() ) {147 foreach ( $ajax_actions as $ajax_action ) {148 $action = key( $ajax_action );149 150 add_action( 'wp_ajax_' . $action, $ajax_action[ $action ]['function'] );151 152 if ( ! empty( $ajax_action[ $action ]['nopriv'] ) ) {153 add_action( 'wp_ajax_nopriv_' . $action, $ajax_action[ $action ]['function'] );154 }155 }156 } -
trunk/src/bp-templates/bp-nouveau/includes/blogs/ajax.php
r11899 r11903 9 9 defined( 'ABSPATH' ) || exit; 10 10 11 /** 12 * Registers friends AJAX actions. 13 * 14 * @todo this funciton CANNOT be run when the file is included (like it is now). Move to a function and hook to something. 15 */ 16 bp_nouveau_register_ajax_actions( 17 array( 11 add_action( 'admin_init', function() { 12 $ajax_actions = array( 18 13 array( 19 14 'blogs_filter' => array( … … 22 17 ), 23 18 ), 24 ) 25 ); 19 ); 20 21 foreach ( $ajax_actions as $ajax_action ) { 22 $action = key( $ajax_action ); 23 24 add_action( 'wp_ajax_' . $action, $ajax_action[ $action ]['function'] ); 25 26 if ( ! empty( $ajax_action[ $action ]['nopriv'] ) ) { 27 add_action( 'wp_ajax_nopriv_' . $action, $ajax_action[ $action ]['function'] ); 28 } 29 } 30 }, 12 ); -
trunk/src/bp-templates/bp-nouveau/includes/friends/ajax.php
r11899 r11903 9 9 defined( 'ABSPATH' ) || exit; 10 10 11 /** 12 * Registers friends AJAX actions. 13 */ 14 bp_nouveau_register_ajax_actions( 15 array( 11 add_action( 'admin_init', function() { 12 $ajax_actions = array( 16 13 array( 17 14 'friends_remove_friend' => array( … … 44 41 ), 45 42 ), 46 ) 47 ); 43 ); 44 45 foreach ( $ajax_actions as $ajax_action ) { 46 $action = key( $ajax_action ); 47 48 add_action( 'wp_ajax_' . $action, $ajax_action[ $action ]['function'] ); 49 50 if ( ! empty( $ajax_action[ $action ]['nopriv'] ) ) { 51 add_action( 'wp_ajax_nopriv_' . $action, $ajax_action[ $action ]['function'] ); 52 } 53 } 54 }, 12 ); 48 55 49 56 /** -
trunk/src/bp-templates/bp-nouveau/includes/groups/ajax.php
r11901 r11903 9 9 defined( 'ABSPATH' ) || exit; 10 10 11 /** 12 * Registers groups AJAX actions. 13 */ 14 bp_nouveau_register_ajax_actions( array( 15 array( 'groups_filter' => array( 'function' => 'bp_nouveau_ajax_object_template_loader', 'nopriv' => true ) ), 16 array( 'groups_join_group' => array( 'function' => 'bp_nouveau_ajax_joinleave_group', 'nopriv' => false ) ), 17 array( 'groups_leave_group' => array( 'function' => 'bp_nouveau_ajax_joinleave_group', 'nopriv' => false ) ), 18 array( 'groups_accept_invite' => array( 'function' => 'bp_nouveau_ajax_joinleave_group', 'nopriv' => false ) ), 19 array( 'groups_reject_invite' => array( 'function' => 'bp_nouveau_ajax_joinleave_group', 'nopriv' => false ) ), 20 array( 'groups_request_membership' => array( 'function' => 'bp_nouveau_ajax_joinleave_group', 'nopriv' => false ) ), 21 array( 'groups_get_group_potential_invites' => array( 'function' => 'bp_nouveau_ajax_get_users_to_invite', 'nopriv' => false ) ), 22 array( 'groups_send_group_invites' => array( 'function' => 'bp_nouveau_ajax_send_group_invites', 'nopriv' => false ) ), 23 array( 'groups_delete_group_invite' => array( 'function' => 'bp_nouveau_ajax_remove_group_invite', 'nopriv' => false ) ), 24 ) ); 11 add_action( 'admin_init', function() { 12 $ajax_actions = array( 13 array( 'groups_filter' => array( 'function' => 'bp_nouveau_ajax_object_template_loader', 'nopriv' => true ) ), 14 array( 'groups_join_group' => array( 'function' => 'bp_nouveau_ajax_joinleave_group', 'nopriv' => false ) ), 15 array( 'groups_leave_group' => array( 'function' => 'bp_nouveau_ajax_joinleave_group', 'nopriv' => false ) ), 16 array( 'groups_accept_invite' => array( 'function' => 'bp_nouveau_ajax_joinleave_group', 'nopriv' => false ) ), 17 array( 'groups_reject_invite' => array( 'function' => 'bp_nouveau_ajax_joinleave_group', 'nopriv' => false ) ), 18 array( 'groups_request_membership' => array( 'function' => 'bp_nouveau_ajax_joinleave_group', 'nopriv' => false ) ), 19 array( 'groups_get_group_potential_invites' => array( 'function' => 'bp_nouveau_ajax_get_users_to_invite', 'nopriv' => false ) ), 20 array( 'groups_send_group_invites' => array( 'function' => 'bp_nouveau_ajax_send_group_invites', 'nopriv' => false ) ), 21 array( 'groups_delete_group_invite' => array( 'function' => 'bp_nouveau_ajax_remove_group_invite', 'nopriv' => false ) ), 22 ); 23 24 foreach ( $ajax_actions as $ajax_action ) { 25 $action = key( $ajax_action ); 26 27 add_action( 'wp_ajax_' . $action, $ajax_action[ $action ]['function'] ); 28 29 if ( ! empty( $ajax_action[ $action ]['nopriv'] ) ) { 30 add_action( 'wp_ajax_nopriv_' . $action, $ajax_action[ $action ]['function'] ); 31 } 32 } 33 }, 12 ); 25 34 26 35 /** -
trunk/src/bp-templates/bp-nouveau/includes/messages/ajax.php
r11901 r11903 9 9 defined( 'ABSPATH' ) || exit; 10 10 11 /** 12 * Registers messages AJAX actions. 13 * 14 * @todo this funciton CANNOT be run when the file is included (like it is now). Move to a function and hook to something. 15 */ 16 bp_nouveau_register_ajax_actions( array( 17 array( 'messages_send_message' => array( 'function' => 'bp_nouveau_ajax_messages_send_message', 'nopriv' => false ) ), 18 array( 'messages_send_reply' => array( 'function' => 'bp_nouveau_ajax_messages_send_reply', 'nopriv' => false ) ), 19 array( 'messages_get_user_message_threads' => array( 'function' => 'bp_nouveau_ajax_get_user_message_threads', 'nopriv' => false ) ), 20 array( 'messages_thread_read' => array( 'function' => 'bp_nouveau_ajax_messages_thread_read', 'nopriv' => false ) ), 21 array( 'messages_get_thread_messages' => array( 'function' => 'bp_nouveau_ajax_get_thread_messages', 'nopriv' => false ) ), 22 array( 'messages_delete' => array( 'function' => 'bp_nouveau_ajax_delete_thread_messages', 'nopriv' => false ) ), 23 array( 'messages_unstar' => array( 'function' => 'bp_nouveau_ajax_star_thread_messages', 'nopriv' => false ) ), 24 array( 'messages_star' => array( 'function' => 'bp_nouveau_ajax_star_thread_messages', 'nopriv' => false ) ), 25 array( 'messages_unread' => array( 'function' => 'bp_nouveau_ajax_readunread_thread_messages', 'nopriv' => false ) ), 26 array( 'messages_read' => array( 'function' => 'bp_nouveau_ajax_readunread_thread_messages', 'nopriv' => false ) ), 27 array( 'messages_dismiss_sitewide_notice' => array( 'function' => 'bp_nouveau_ajax_dismiss_sitewide_notice', 'nopriv' => false ) ), 28 ) ); 11 add_action( 'admin_init', function() { 12 $ajax_actions = array( 13 array( 'messages_send_message' => array( 'function' => 'bp_nouveau_ajax_messages_send_message', 'nopriv' => false ) ), 14 array( 'messages_send_reply' => array( 'function' => 'bp_nouveau_ajax_messages_send_reply', 'nopriv' => false ) ), 15 array( 'messages_get_user_message_threads' => array( 'function' => 'bp_nouveau_ajax_get_user_message_threads', 'nopriv' => false ) ), 16 array( 'messages_thread_read' => array( 'function' => 'bp_nouveau_ajax_messages_thread_read', 'nopriv' => false ) ), 17 array( 'messages_get_thread_messages' => array( 'function' => 'bp_nouveau_ajax_get_thread_messages', 'nopriv' => false ) ), 18 array( 'messages_delete' => array( 'function' => 'bp_nouveau_ajax_delete_thread_messages', 'nopriv' => false ) ), 19 array( 'messages_unstar' => array( 'function' => 'bp_nouveau_ajax_star_thread_messages', 'nopriv' => false ) ), 20 array( 'messages_star' => array( 'function' => 'bp_nouveau_ajax_star_thread_messages', 'nopriv' => false ) ), 21 array( 'messages_unread' => array( 'function' => 'bp_nouveau_ajax_readunread_thread_messages', 'nopriv' => false ) ), 22 array( 'messages_read' => array( 'function' => 'bp_nouveau_ajax_readunread_thread_messages', 'nopriv' => false ) ), 23 array( 'messages_dismiss_sitewide_notice' => array( 'function' => 'bp_nouveau_ajax_dismiss_sitewide_notice', 'nopriv' => false ) ), 24 ); 25 26 foreach ( $ajax_actions as $ajax_action ) { 27 $action = key( $ajax_action ); 28 29 add_action( 'wp_ajax_' . $action, $ajax_action[ $action ]['function'] ); 30 31 if ( ! empty( $ajax_action[ $action ]['nopriv'] ) ) { 32 add_action( 'wp_ajax_nopriv_' . $action, $ajax_action[ $action ]['function'] ); 33 } 34 } 35 }, 12 ); 29 36 30 37 /**
Note: See TracChangeset
for help on using the changeset viewer.