Ticket #1793: remove_cookies_apeatling.diff
| File remove_cookies_apeatling.diff, 39.4 KB (added by , 16 years ago) |
|---|
-
bp-blogs/bp-blogs-templatetags.php
116 116 */ 117 117 $type = 'active'; 118 118 $user_id = false; 119 $ page = 1;119 $search_terms = false; 120 120 121 121 /* User filtering */ 122 if ( !empty( $bp->displayed_user->id ) || 'personal' == $_COOKIE['bp-blogs-scope'])123 $user_id = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id;122 if ( !empty( $bp->displayed_user->id ) ) 123 $user_id = $bp->displayed_user->id; 124 124 125 /* Action filtering */ 126 if ( !empty( $_COOKIE['bp-blogs-filter'] ) && '-1' != $_COOKIE['bp-blogs-filter'] ) 127 $type = $_COOKIE['bp-blogs-filter']; 125 if ( !empty( $_REQUEST['s'] ) ) 126 $search_terms = $_REQUEST['s']; 128 127 129 if ( !empty( $_COOKIE['bp-blogs-page'] ) && '-1' != $_COOKIE['bp-blogs-page'] )130 $page = $_COOKIE['bp-blogs-page'];131 132 128 $defaults = array( 133 129 'type' => $type, 134 'page' => $page,130 'page' => 1, 135 131 'per_page' => 20, 136 132 'max' => false, 137 133 138 134 'user_id' => $user_id, // Pass a user_id to limit to only blogs this user has higher than subscriber access to 139 'search_terms' => false// Pass search terms to filter on the blog title or description.135 'search_terms' => $search_terms // Pass search terms to filter on the blog title or description. 140 136 ); 141 137 142 138 $r = wp_parse_args( $args, $defaults ); 143 139 extract( $r ); 144 140 145 // type: active ( default ) | random | newest | alphabetical146 147 if ( !empty( $_REQUEST['s'] ) )148 $search_terms = $_REQUEST['s'];149 150 141 if ( $max ) { 151 142 if ( $per_page > $max ) 152 143 $per_page = $max; 153 144 } 154 145 155 146 $blogs_template = new BP_Blogs_Template( $type, $page, $per_page, $max, $user_id, $search_terms ); 156 157 147 return $blogs_template->has_blogs(); 158 148 } 159 149 -
bp-themes/bp-default/groups/groups-loop.php
2 2 3 3 <?php do_action( 'bp_before_groups_loop' ) ?> 4 4 5 <?php if ( bp_has_groups( bp_ ajax_querystring() ) ) : ?>5 <?php if ( bp_has_groups( bp_dtheme_ajax_querystring( 'groups' ) ) ) : ?> 6 6 7 7 <div class="pagination"> 8 8 -
bp-themes/bp-default/members/members-loop.php
2 2 3 3 <?php do_action( 'bp_before_members_loop' ) ?> 4 4 5 <?php if ( bp_has_members( bp_ ajax_querystring() ) ) : ?>5 <?php if ( bp_has_members( bp_dtheme_ajax_querystring( 'members' ) ) ) : ?> 6 6 7 7 <div class="pagination"> 8 8 -
bp-themes/bp-default/activity/activity-loop.php
2 2 3 3 <?php do_action( 'bp_before_activity_loop' ) ?> 4 4 5 <?php if ( bp_has_activities( bp_ ajax_querystring() ) ) : ?>5 <?php if ( bp_has_activities( bp_dtheme_ajax_querystring( 'activity' ) ) ) : ?> 6 6 7 7 <?php /* Show pagination if JS is not enabled, since the "Load More" link will do nothing */ ?> 8 8 <noscript> -
bp-themes/bp-default/blogs/blogs-loop.php
2 2 3 3 <?php do_action( 'bp_before_blogs_loop' ) ?> 4 4 5 <?php if ( bp_has_blogs( bp_ ajax_querystring() ) ) : ?>5 <?php if ( bp_has_blogs( bp_dtheme_ajax_querystring( 'blogs' ) ) ) : ?> 6 6 7 7 <div class="pagination"> 8 8 -
bp-themes/bp-default/_inc/ajax.php
9 9 * your own _inc/ajax.php file and add/remove AJAX functionality as you see fit. 10 10 */ 11 11 12 function bp_dtheme_object_filter() { 12 /*** 13 * Each object loop (activity/members/groups/blogs/forums) contains parameters to 14 * show specific information based on the page we are currently looking at. 15 * The following function will take into account any cookies set in the JS and allow us 16 * to override the parameters sent. That way we can change the results returned without reloading the page. 17 */ 18 function bp_dtheme_ajax_querystring( $object = false ) { 13 19 global $bp; 14 20 15 $object = esc_attr( $_POST['object'] ); 16 $filter = esc_attr( $_POST['filter'] ); 17 $page = esc_attr( $_POST['page'] ); 18 $search_terms = esc_attr( $_POST['search_terms'] ); 21 if ( empty( $object ) ) 22 return false; 19 23 20 /** 21 * Scope is the scope of results to use, either all (everything) or personal (just mine). 22 * For example if the object is groups, it would be all groups, or just groups I belong to. 24 /* Set up the cookies passed on this AJAX request. */ 25 if ( !empty( $_POST['cookie'] ) ) 26 $_COOKIE = wp_parse_args( str_replace( '; ', '&', urldecode( $_POST['cookie'] ) ) ); 27 28 $qs = false; 29 30 /*** 31 * Check if any cookie values are set. If there are then override the default params passed to the 32 * template loop 23 33 */ 24 $scope = esc_attr( $_POST['scope'] ); 34 if ( !empty( $_COOKIE['bp-' . $object . '-filter'] ) && '-1' != $_COOKIE['bp-' . $object . '-filter'] ) { 35 $qs[] = 'type=' . $_COOKIE['bp-' . $object . '-filter']; 36 $qs[] = 'action=' . $_COOKIE['bp-' . $object . '-filter']; // Activity stream filtering on action 37 } 25 38 26 /* Plugins can pass extra parameters and use the bp_dtheme_ajax_querystring_content_filter filter to parse them */ 27 $extras = esc_attr( $_POST['extras'] ); 39 if ( !empty( $_COOKIE['bp-' . $object . '-scope'] ) ) { 40 if ( 'personal' == $_COOKIE['bp-' . $object . '-scope'] ) { 41 $user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id; 42 $qs[] = 'user_id=' . $user_id; 43 } 44 $qs[] = 'scope=' . $_COOKIE['bp-' . $object . '-scope']; // Activity stream scope 45 } 28 46 29 if ( __( 'Search anything...', 'buddypress' ) == $search_terms || 'false' == $search_terms)30 $ search_terms = false;47 if ( !empty( $_COOKIE['bp-' . $object . '-page'] ) && '-1' != $_COOKIE['bp-' . $object . '-page'] ) 48 $qs[] = 'page=' . $_COOKIE['bp-' . $object . '-page']; 31 49 32 /* Build the querystring */ 33 if ( empty( $filter ) ) 34 $filter = 'active'; 50 if ( !empty( $_COOKIE['bp-' . $object . '-search-terms'] ) && __( 'Search anything...', 'buddypress' ) != $_COOKIE['bp-' . $object . '-search-terms'] && 'false' != $_COOKIE['bp-' . $object . '-search-terms'] ) 51 $qs[] = 'search_terms=' . $_COOKIE['bp-' . $object . '-search-terms']; 35 52 36 $bp->ajax_querystring = 'type=' . $filter . '&page=' . $page; 53 /* Now pass the querystring to override default values. */ 54 if ( !empty( $qs ) ) 55 return apply_filters( 'bp_dtheme_ajax_querystring', join( '&', (array)$qs ), $object, $_COOKIE['bp-' . $object . '-filter'], $_COOKIE['bp-' . $object . '-scope'], $_COOKIE['bp-' . $object . '-page'], $_COOKIE['bp-' . $object . '-search-terms'], $_COOKIE['bp-' . $object . '-extras'] ); 56 } 37 57 38 if ( !empty( $search_terms ) ) 39 $bp->ajax_querystring .= '&search_terms=' . $search_terms; 58 function bp_dtheme_object_template_loader() { 59 $object = esc_attr( $_POST['object'] ); 60 locate_template( array( "$object/$object-loop.php" ), true ); 61 } 62 add_action( 'wp_ajax_members_filter', 'bp_dtheme_object_template_loader' ); 63 add_action( 'wp_ajax_groups_filter', 'bp_dtheme_object_template_loader' ); 64 add_action( 'wp_ajax_blogs_filter', 'bp_dtheme_object_template_loader' ); 65 add_action( 'wp_ajax_forums_filter', 'bp_dtheme_object_template_loader' ); 40 66 41 if ( $scope == 'personal' || $bp->displayed_user->id ) { 42 $user_id = ( $bp->displayed_user->id ) ? $bp->displayed_user->id : $bp->loggedin_user->id; 43 $bp->ajax_querystring .= '&user_id=' . $user_id; 44 } 67 function bp_dtheme_activity_template_loader() { 68 global $bp; 45 69 46 $bp->ajax_querystring = apply_filters( 'bp_dtheme_ajax_querystring_content_filter', $bp->ajax_querystring, $extras ); 70 /* Buffer the loop in the template to a var for JS to spit out. */ 71 ob_start(); 72 locate_template( array( 'activity/activity-loop.php' ), true ); 73 $result['contents'] = ob_get_contents(); 74 ob_end_clean(); 47 75 48 locate_template( array( "$object/$object-loop.php" ), true);76 echo json_encode( $result ); 49 77 } 50 add_action( 'wp_ajax_members_filter', 'bp_dtheme_object_filter' ); 51 add_action( 'wp_ajax_groups_filter', 'bp_dtheme_object_filter' ); 52 add_action( 'wp_ajax_blogs_filter', 'bp_dtheme_object_filter' ); 53 add_action( 'wp_ajax_forums_filter', 'bp_dtheme_object_filter' ); 78 add_action( 'wp_ajax_activity_widget_filter', 'bp_dtheme_activity_template_loader' ); 79 add_action( 'wp_ajax_activity_get_older_updates', 'bp_dtheme_activity_template_loader' ); 54 80 55 81 function bp_dtheme_post_update() { 56 82 global $bp; … … 177 203 add_action( 'wp_ajax_delete_activity_comment', 'bp_dtheme_delete_activity' ); 178 204 add_action( 'wp_ajax_delete_activity', 'bp_dtheme_delete_activity' ); 179 205 180 function bp_dtheme_activity_loop( $scope = false, $filter = false, $per_page = 20, $page = 1 ) {181 global $bp;182 183 /* If we are on a profile page we only want to show that users activity */184 if ( $bp->displayed_user->id ) {185 $query_string = 'user_id=' . $bp->displayed_user->id;186 } else {187 if ( !empty( $bp->groups->current_group ) )188 $scope = 'all';189 190 $feed_url = site_url( BP_ACTIVITY_SLUG . '/feed/' );191 192 switch ( $scope ) {193 case BP_FRIENDS_SLUG:194 $friend_ids = implode( ',', friends_get_friend_user_ids( $bp->loggedin_user->id ) );195 $query_string = 'user_id=' . $friend_ids;196 $feed_url = $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/' . BP_FRIENDS_SLUG . '/feed/';197 break;198 case BP_GROUPS_SLUG:199 $groups = groups_get_user_groups( $bp->loggedin_user->id );200 $group_ids = implode( ',', $groups['groups'] );201 $query_string = 'object=groups&primary_id=' . $group_ids . '&show_hidden=1';202 $feed_url = $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/' . BP_GROUPS_SLUG . '/feed/';203 break;204 case 'favorites':205 $favs = bp_activity_get_user_favorites( $bp->loggedin_user->id );206 207 if ( empty( $favs ) )208 $favorite_ids = false;209 210 $favorite_ids = implode( ',', (array)$favs );211 $query_string = 'include=' . $favorite_ids;212 $feed_url = $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/favorites/feed/';213 break;214 case 'mentions':215 $query_string = 'show_hidden=1&search_terms=@' . bp_core_get_username( $bp->loggedin_user->id, $bp->loggedin_user->userdata->user_nicename, $bp->loggedin_user->userdata->user_login );216 $feed_url = $bp->loggedin_user->domain . BP_ACTIVITY_SLUG . '/mentions/feed/';217 218 /* Reset the number of new @ mentions for the user */219 delete_usermeta( $bp->loggedin_user->id, 'bp_new_mention_count' );220 break;221 }222 }223 224 /* Build the filter */225 if ( $filter && $filter != '-1' )226 $query_string .= '&action=' . $filter;227 228 /* If we are viewing a group then filter the activity just for this group */229 if ( !empty( $bp->groups->current_group ) ) {230 $query_string .= '&object=' . $bp->groups->id . '&primary_id=' . $bp->groups->current_group->id;231 232 /* If we're viewing a non-private group and the user is a member, show the hidden activity for the group */233 if ( 'public' != $bp->groups->current_group->status && groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )234 $query_string .= '&show_hidden=1';235 }236 237 /* Add the per_page param */238 $query_string .= '&per_page=' . $per_page;239 240 /* Add the comments param */241 if ( $bp->displayed_user->id || 'mentions' == $scope )242 $query_string .= '&display_comments=stream';243 else244 $query_string .= '&display_comments=threaded';245 246 /* Add the new page param */247 $args = explode( '&', trim( $query_string ) );248 foreach( (array)$args as $arg ) {249 if ( false === strpos( $arg, 'page' ) )250 $new_args[] = $arg;251 }252 $query_string = implode( '&', $new_args ) . '&page=' . $page;253 254 $bp->ajax_querystring = apply_filters( 'bp_dtheme_ajax_querystring_activity_filter', $query_string, $scope );255 $result['query_string'] = $bp->ajax_querystring;256 $result['feed_url'] = apply_filters( 'bp_dtheme_ajax_feed_url', $feed_url );257 258 /* Buffer the loop in the template to a var for JS to spit out. */259 ob_start();260 locate_template( array( 'activity/activity-loop.php' ), true );261 $result['contents'] = ob_get_contents();262 ob_end_clean();263 264 echo json_encode( $result );265 }266 267 function bp_dtheme_ajax_widget_filter() {268 bp_dtheme_activity_loop( $_POST['scope'], $_POST['filter'] );269 }270 add_action( 'wp_ajax_activity_widget_filter', 'bp_dtheme_ajax_widget_filter' );271 272 function bp_dtheme_ajax_load_older_updates() {273 bp_dtheme_activity_loop( false, false, 20, $_POST['page'] );274 }275 add_action( 'wp_ajax_activity_get_older_updates', 'bp_dtheme_ajax_load_older_updates' );276 277 206 function bp_dtheme_mark_activity_favorite() { 278 207 global $bp; 279 208 -
bp-themes/bp-default/_inc/global.js
2 2 var j = jQuery; 3 3 4 4 // Global variable to prevent multiple AJAX requests 5 var activity_request = null;5 var bp_ajax_request = null; 6 6 7 7 j(document).ready( function() { 8 8 /**** Page Load Actions *******************************************************/ … … 111 111 return false; 112 112 113 113 /* Reset the page */ 114 j.cookie( 'bp-activity-oldestpage', 1 );114 j.cookie( 'bp-activity-oldestpage', 1, {path: '/'} ); 115 115 116 116 /* Activity Stream Tabs */ 117 117 var scope = target.attr('id').substr( 9, target.attr('id').length ); … … 130 130 var selected_tab = j( 'div.activity-type-tabs li.selected' ); 131 131 132 132 if ( !selected_tab.length ) 133 var scope = 'all';133 var scope = null; 134 134 else 135 135 var scope = selected_tab.attr('id').substr( 9, selected_tab.attr('id').length ); 136 136 … … 231 231 j("li.load-more").addClass('loading'); 232 232 233 233 if ( null == j.cookie('bp-activity-oldestpage') ) 234 j.cookie('bp-activity-oldestpage', 1 );234 j.cookie('bp-activity-oldestpage', 1, {path: '/'} ); 235 235 236 236 var oldest_page = ( j.cookie('bp-activity-oldestpage') * 1 ) + 1; 237 237 … … 243 243 function(response) 244 244 { 245 245 j("li.load-more").removeClass('loading'); 246 j.cookie( 'bp-activity-oldestpage', oldest_page );246 j.cookie( 'bp-activity-oldestpage', oldest_page, {path: '/'} ); 247 247 j("ul.activity-list").append(response.contents); 248 248 249 249 target.parent().hide(); … … 1031 1031 /* Setup activity scope and filter based on the current cookie settings. */ 1032 1032 function bp_init_activity() { 1033 1033 /* Reset the page */ 1034 j.cookie( 'bp-activity-oldestpage', 1 );1034 j.cookie( 'bp-activity-oldestpage', 1, {path: '/'} ); 1035 1035 1036 1036 if ( null != j.cookie('bp-activity-filter') && j('#activity-filter-select').length ) 1037 1037 j('#activity-filter-select select option[value=' + j.cookie('bp-activity-filter') + ']').attr( 'selected', 'selected' ); … … 1070 1070 if ( 'activity' == object ) 1071 1071 return false; 1072 1072 1073 if ( null == scope )1074 var scope = 'all';1075 1076 if ( null == filter )1077 var filter = 'active';1078 1079 if ( null == page )1080 var page = 1;1081 1082 if ( null == search_terms )1083 var search_terms = false;1084 1085 if ( null == extras )1086 var extras = false;1087 1088 1073 if ( j.query.get('s') ) 1089 1074 search_terms = j.query.get('s'); 1090 1075 … … 1096 1081 j.cookie( 'bp-' + object + '-extras', extras, null ); 1097 1082 1098 1083 /* Set the correct selected nav and filter */ 1099 j('div.item-list-tabs li').each( function() { 1100 j(this).removeClass('selected'); 1101 }); 1102 j('div.item-list-tabs li#' + object + '-' + scope + ', div.item-list-tabs#object-nav li.current').addClass('selected'); 1084 if ( null != scope ) { 1085 j('div.item-list-tabs li').each( function() { 1086 j(this).removeClass('selected'); 1087 }); 1088 j('div.item-list-tabs li#' + object + '-' + scope + ', div.item-list-tabs#object-nav li.current').addClass('selected'); 1089 } 1103 1090 j('div.item-list-tabs li.selected').addClass('loading'); 1104 1091 j('div.item-list-tabs select option[value=' + filter + ']').attr( 'selected', 'selected' ); 1105 1092 … … 1128 1115 1129 1116 /* Activity Loop Requesting */ 1130 1117 function bp_activity_request(scope, filter) { 1131 if ( null == scope )1132 var scope = 'all';1133 1134 if ( null == filter )1135 var filter = '-1';1136 1137 1118 /* Save the type and filter to a session cookie */ 1138 j.cookie( 'bp-activity-scope', scope , null);1139 j.cookie( 'bp-activity-filter', filter , null);1140 j.cookie( 'bp-activity-oldestpage', 1 );1119 j.cookie( 'bp-activity-scope', scope ); 1120 j.cookie( 'bp-activity-filter', filter ); 1121 j.cookie( 'bp-activity-oldestpage', 1, {path: '/'} ); 1141 1122 1142 1123 /* Remove selected and loading classes from tabs */ 1143 j('div.item-list-tabs li').each( function() { 1144 j(this).removeClass('selected loading'); 1145 }); 1146 1147 /* Set the correct selected nav and filter */ 1148 j('li#activity-' + scope + ', div.item-list-tabs li.current').addClass('selected'); 1124 if ( null != scope ) { 1125 j('div.item-list-tabs li').each( function() { 1126 j(this).removeClass('selected loading'); 1127 }); 1128 /* Set the correct selected nav and filter */ 1129 j('li#activity-' + scope + ', div.item-list-tabs li.current').addClass('selected'); 1130 } 1149 1131 j('div#object-nav.item-list-tabs li.selected, div.activity-type-tabs li.selected').addClass('loading'); 1150 1132 j('#activity-filter-select select option[value=' + filter + ']').attr( 'selected', 'selected' ); 1151 1133 1152 1134 /* Reload the activity stream based on the selection */ 1153 1135 j('.widget_bp_activity_widget h2 span.ajax-loader').show(); 1154 1136 1155 if ( activity_request )1156 activity_request.abort();1137 if ( bp_ajax_request ) 1138 bp_ajax_request.abort(); 1157 1139 1158 activity_request = j.post( ajaxurl, {1140 bp_ajax_request = j.post( ajaxurl, { 1159 1141 action: 'activity_widget_filter', 1160 1142 'cookie': encodeURIComponent(document.cookie), 1161 1143 '_wpnonce_activity_filter': j("input#_wpnonce_activity_filter").val(), … … 1250 1232 jQuery.extend({easing:{easein:function(x,t,b,c,d){return c*(t/=d)*t+b},easeinout:function(x,t,b,c,d){if(t<d/2)return 2*c*t*t/(d*d)+b;var ts=t-d/2;return-2*c*ts*ts/(d*d)+2*c*ts/d+c/2+b},easeout:function(x,t,b,c,d){return-c*t*t/(d*d)+2*c*t/d+b},expoin:function(x,t,b,c,d){var flip=1;if(c<0){flip*=-1;c*=-1}return flip*(Math.exp(Math.log(c)/d*t))+b},expoout:function(x,t,b,c,d){var flip=1;if(c<0){flip*=-1;c*=-1}return flip*(-Math.exp(-Math.log(c)/d*(t-d))+c+1)+b},expoinout:function(x,t,b,c,d){var flip=1;if(c<0){flip*=-1;c*=-1}if(t<d/2)return flip*(Math.exp(Math.log(c/2)/(d/2)*t))+b;return flip*(-Math.exp(-2*Math.log(c/2)/d*(t-d))+c+1)+b},bouncein:function(x,t,b,c,d){return c-jQuery.easing['bounceout'](x,d-t,0,c,d)+b},bounceout:function(x,t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b}},bounceinout:function(x,t,b,c,d){if(t<d/2)return jQuery.easing['bouncein'](x,t*2,0,c,d)*.5+b;return jQuery.easing['bounceout'](x,t*2-d,0,c,d)*.5+c*.5+b},elasin:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b},elasout:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b},elasinout:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b},backin:function(x,t,b,c,d){var s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b},backout:function(x,t,b,c,d){var s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},backinout:function(x,t,b,c,d){var s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b},linear:function(x,t,b,c,d){return c*t/d+b}}}); 1251 1233 1252 1234 /* jQuery Cookie plugin */ 1253 eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('o.5=B(9,b,2){6(h b!=\'E\'){2=2||{};6(b===n){b=\'\';2.3=-1}4 3=\'\';6(2.3&&(h 2.3==\'j\'||2.3.k)){4 7;6(h 2.3==\'j\'){7=w u();7.t(7.q()+(2.3*r*l*l*x))}m{7=2.3}3=\'; 3=\'+7.k()}4 8=2.8?\'; 8=\'+(2.8):\'\';4 a=2.a?\'; a=\'+(2.a):\'\';4 c=2.c?\'; c\':\'\';d.5=[9,\'=\',C(b),3,8,a,c].y(\'\')}m{4 e=n;6(d.5&&d.5!=\'\'){4 g=d.5.A(\';\');s(4 i=0;i<g.f;i++){4 5=o.z(g[i]);6(5.p(0,9.f+1)==(9+\'=\')){e=D(5.p(9.f+1));v}}}F e}};',42,42,'||options|expires|var|cookie|if|date|path|name|domain|value|secure|document|cookieValue|length|cookies|typeof||number|toUTCString|60|else|null|jQuery|substring|getTime|24|for|setTime|Date|break|new|1000|join|trim|split|function|encodeURIComponent|decodeURIComponent|undefined|return'.split('|'),0,{})) 1235 jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}expires='; expires='+date.toUTCString();}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}return cookieValue;}}; 1254 1236 1255 1237 /* jQuery querystring plugin */ 1256 1238 eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('M 6(A){4 $11=A.11||\'&\';4 $V=A.V===r?r:j;4 $1p=A.1p===r?\'\':\'[]\';4 $13=A.13===r?r:j;4 $D=$13?A.D===j?"#":"?":"";4 $15=A.15===r?r:j;v.1o=M 6(){4 f=6(o,t){8 o!=1v&&o!==x&&(!!t?o.1t==t:j)};4 14=6(1m){4 m,1l=/\\[([^[]*)\\]/g,T=/^([^[]+)(\\[.*\\])?$/.1r(1m),k=T[1],e=[];19(m=1l.1r(T[2]))e.u(m[1]);8[k,e]};4 w=6(3,e,7){4 o,y=e.1b();b(I 3!=\'X\')3=x;b(y===""){b(!3)3=[];b(f(3,L)){3.u(e.h==0?7:w(x,e.z(0),7))}n b(f(3,1a)){4 i=0;19(3[i++]!=x);3[--i]=e.h==0?7:w(3[i],e.z(0),7)}n{3=[];3.u(e.h==0?7:w(x,e.z(0),7))}}n b(y&&y.T(/^\\s*[0-9]+\\s*$/)){4 H=1c(y,10);b(!3)3=[];3[H]=e.h==0?7:w(3[H],e.z(0),7)}n b(y){4 H=y.B(/^\\s*|\\s*$/g,"");b(!3)3={};b(f(3,L)){4 18={};1w(4 i=0;i<3.h;++i){18[i]=3[i]}3=18}3[H]=e.h==0?7:w(3[H],e.z(0),7)}n{8 7}8 3};4 C=6(a){4 p=d;p.l={};b(a.C){v.J(a.Z(),6(5,c){p.O(5,c)})}n{v.J(1u,6(){4 q=""+d;q=q.B(/^[?#]/,\'\');q=q.B(/[;&]$/,\'\');b($V)q=q.B(/[+]/g,\' \');v.J(q.Y(/[&;]/),6(){4 5=1e(d.Y(\'=\')[0]||"");4 c=1e(d.Y(\'=\')[1]||"");b(!5)8;b($15){b(/^[+-]?[0-9]+\\.[0-9]*$/.1d(c))c=1A(c);n b(/^[+-]?[0-9]+$/.1d(c))c=1c(c,10)}c=(!c&&c!==0)?j:c;b(c!==r&&c!==j&&I c!=\'1g\')c=c;p.O(5,c)})})}8 p};C.1H={C:j,1G:6(5,1f){4 7=d.Z(5);8 f(7,1f)},1h:6(5){b(!f(5))8 d.l;4 K=14(5),k=K[0],e=K[1];4 3=d.l[k];19(3!=x&&e.h!=0){3=3[e.1b()]}8 I 3==\'1g\'?3:3||""},Z:6(5){4 3=d.1h(5);b(f(3,1a))8 v.1E(j,{},3);n b(f(3,L))8 3.z(0);8 3},O:6(5,c){4 7=!f(c)?x:c;4 K=14(5),k=K[0],e=K[1];4 3=d.l[k];d.l[k]=w(3,e.z(0),7);8 d},w:6(5,c){8 d.N().O(5,c)},1s:6(5){8 d.O(5,x).17()},1z:6(5){8 d.N().1s(5)},1j:6(){4 p=d;v.J(p.l,6(5,7){1y p.l[5]});8 p},1F:6(Q){4 D=Q.B(/^.*?[#](.+?)(?:\\?.+)?$/,"$1");4 S=Q.B(/^.*?[?](.+?)(?:#.+)?$/,"$1");8 M C(Q.h==S.h?\'\':S,Q.h==D.h?\'\':D)},1x:6(){8 d.N().1j()},N:6(){8 M C(d)},17:6(){6 F(G){4 R=I G=="X"?f(G,L)?[]:{}:G;b(I G==\'X\'){6 1k(o,5,7){b(f(o,L))o.u(7);n o[5]=7}v.J(G,6(5,7){b(!f(7))8 j;1k(R,5,F(7))})}8 R}d.l=F(d.l);8 d},1B:6(){8 d.N().17()},1D:6(){4 i=0,U=[],W=[],p=d;4 16=6(E){E=E+"";b($V)E=E.B(/ /g,"+");8 1C(E)};4 1n=6(1i,5,7){b(!f(7)||7===r)8;4 o=[16(5)];b(7!==j){o.u("=");o.u(16(7))}1i.u(o.P(""))};4 F=6(R,k){4 12=6(5){8!k||k==""?[5].P(""):[k,"[",5,"]"].P("")};v.J(R,6(5,7){b(I 7==\'X\')F(7,12(5));n 1n(W,12(5),7)})};F(d.l);b(W.h>0)U.u($D);U.u(W.P($11));8 U.P("")}};8 M C(1q.S,1q.D)}}(v.1o||{});',62,106,'|||target|var|key|function|value|return|||if|val|this|tokens|is||length||true|base|keys||else||self||false|||push|jQuery|set|null|token|slice|settings|replace|queryObject|hash|str|build|orig|index|typeof|each|parsed|Array|new|copy|SET|join|url|obj|search|match|queryString|spaces|chunks|object|split|get||separator|newKey|prefix|parse|numbers|encode|COMPACT|temp|while|Object|shift|parseInt|test|decodeURIComponent|type|number|GET|arr|EMPTY|add|rx|path|addFields|query|suffix|location|exec|REMOVE|constructor|arguments|undefined|for|empty|delete|remove|parseFloat|compact|encodeURIComponent|toString|extend|load|has|prototype'.split('|'),0,{})) -
bp-themes/bp-default/forums/forums-loop.php
1 <?php if ( bp_has_forum_topics( bp_ ajax_querystring() ) ) : ?>1 <?php if ( bp_has_forum_topics( bp_dtheme_ajax_querystring( 'forums' ) ) ) : ?> 2 2 3 3 <div class="pagination"> 4 4 -
bp-core/bp-core-templatetags.php
125 125 $type = 'active'; 126 126 $user_id = false; 127 127 $page = 1; 128 $search_terms = false; 128 129 129 130 /* User filtering */ 130 if ( !empty( $bp->displayed_user->id ) || 'personal' == $_COOKIE['bp-members-scope'])131 $user_id = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id;131 if ( !empty( $bp->displayed_user->id ) ) 132 $user_id = $bp->displayed_user->id; 132 133 133 /* Action filtering*/134 if ( !empty( $_COOKIE['bp-members-filter'] ) && '-1' != $_COOKIE['bp-members-filter'] )135 $ type = $_COOKIE['bp-members-filter'];134 /* Pass a filter if ?s= is set. */ 135 if ( $_REQUEST['s'] ) 136 $search_terms = $_REQUEST['s']; 136 137 137 if ( !empty( $_COOKIE['bp-members-page'] ) && '-1' != $_COOKIE['bp-members-page'] )138 $page = $_COOKIE['bp-members-page'];139 140 138 // type: active ( default ) | random | newest | popular | online | alphabetical 141 139 $defaults = array( 142 140 'type' => $type, … … 147 145 'include' => false, // Pass a user_id or comma separated list of user_ids to only show these users 148 146 149 147 'user_id' => $user_id, // Pass a user_id to only show friends of this user 150 'search_terms' => false, // Pass search_terms to filter users by their profile data148 'search_terms' => $search_terms, // Pass search_terms to filter users by their profile data 151 149 152 150 'populate_extras' => true // Fetch usermeta? Friend count, last active etc. 153 151 ); … … 160 158 $per_page = $max; 161 159 } 162 160 163 /* Pass a filter if ?s= is set. */164 if ( $_REQUEST['s'] )165 $search_terms = $_REQUEST['s'];166 167 if ( false === $user_id && $bp->displayed_user->id )168 $user_id = $bp->displayed_user->id;169 170 161 $members_template = new BP_Core_Members_Template( $type, $page, $per_page, $max, $user_id, $search_terms, $include, (bool)$populate_extras ); 171 162 172 163 return $members_template->has_members(); … … 1392 1383 return $bp->root_domain; 1393 1384 } 1394 1385 1395 /* This function will pass a AJAX built querystring to a loop in the template */1396 function bp_ajax_querystring() {1397 global $bp;1398 1399 return apply_filters( 'bp_ajax_querystring', $bp->ajax_querystring );1400 }1401 1402 1386 /* Template is_() functions to determine the current page */ 1403 1387 1404 1388 function bp_is_active( $component ) { -
bp-activity/bp-activity-templatetags.php
124 124 $user_id = false; 125 125 $include = false; 126 126 $show_hidden = false; 127 $search_terms = false;128 127 $object = false; 129 $action = false;130 128 $primary_id = false; 131 $display_comments = 'threaded';132 129 133 130 /* User filtering */ 134 131 if ( !empty( $bp->displayed_user->id ) ) 135 132 $user_id = $bp->displayed_user->id; 136 133 137 /* Action filtering */138 if ( !empty( $_COOKIE['bp-activity-filter'] ) && '-1' != $_COOKIE['bp-activity-filter'] )139 $action = $_COOKIE['bp-activity-filter'];140 141 /* User activity scope filtering */142 if ( !empty( $user_id ) || !empty( $_COOKIE['bp-activity-scope'] ) ) {143 $scope = ( !empty( $bp->current_action ) ) ? $bp->current_action : $_COOKIE['bp-activity-scope'];144 $current_user_id = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id;145 146 if ( empty( $scope ) || 'just-me' == $scope )147 $display_comments = 'stream';148 149 switch ( $scope ) {150 case 'friends':151 if ( function_exists( 'friends_get_friend_user_ids' ) )152 $user_id = implode( ',', (array)friends_get_friend_user_ids( $current_user_id ) );153 break;154 case 'groups':155 if ( function_exists( 'groups_get_user_groups' ) ) {156 $groups = groups_get_user_groups( $current_user_id );157 $object = $bp->groups->id;158 $primary_id = implode( ',', (array)$groups['groups'] );159 $show_hidden = ( $current_user_id == $bp->loggedin_user->id ) ? 1 : 0;160 $user_id = false;161 }162 break;163 case 'favorites':164 $favs = bp_activity_get_user_favorites( $current_user_id );165 $include = implode( ',', (array)$favs );166 $show_hidden = ( $current_user_id == $bp->loggedin_user->id ) ? 1 : 0;167 break;168 case 'mentions':169 $user_nicename = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->userdata->user_nicename : $bp->loggedin_user->userdata->user_nicename;170 $user_login = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->userdata->user_login : $bp->loggedin_user->userdata->user_login;171 $search_terms = '@' . bp_core_get_username( $current_user_id, $user_nicename, $user_login );172 $show_hidden = ( $current_user_id == $bp->loggedin_user->id ) ? 1 : 0;173 $display_comments = 'stream';174 $user_id = false;175 break;176 }177 }178 179 134 /* Group filtering */ 180 135 if ( !empty( $bp->groups->current_group ) ) { 181 136 $object = $bp->groups->id; … … 191 146 192 147 /* Note: any params used for filtering can be a single value, or multiple values comma separated. */ 193 148 $defaults = array( 194 'display_comments' => $display_comments, // false for none, stream/threaded - show comments in the stream or threaded under items149 'display_comments' => 'threaded', // false for none, stream/threaded - show comments in the stream or threaded under items 195 150 'include' => $include, // pass an activity_id or string of ID's comma separated 196 151 'sort' => 'DESC', // sort DESC or ASC 197 152 'page' => 1, // which page to load … … 199 154 'max' => false, // max number to return 200 155 'show_hidden' => $show_hidden, // Show activity items that are hidden site-wide? 201 156 157 /* Scope - pre-built activity filters for a user (friends/groups/favorites/mentions) */ 158 'scope' => $bp->current_action, 159 202 160 /* Filtering */ 203 161 'user_id' => $user_id, // user_id to filter on 204 162 'object' => $object, // object to filter on e.g. groups, profile, status, friends 205 'action' => $action, // action to filter on e.g. activity_update, new_forum_post, profile_updated163 'action' => false, // action to filter on e.g. activity_update, new_forum_post, profile_updated 206 164 'primary_id' => $primary_id, // object ID to filter on e.g. a group_id or forum_id or blog_id etc. 207 165 'secondary_id' => false, // secondary object ID to filter on e.g. a post_id 208 166 209 167 /* Searching */ 210 'search_terms' => $search_terms// specify terms to search on168 'search_terms' => false // specify terms to search on 211 169 ); 212 170 213 171 $r = wp_parse_args( $args, $defaults ); 214 172 extract( $r ); 215 173 174 /* If you have passed a "scope" then this will override any filters you have passed. */ 175 if ( !empty( $scope ) ) { 176 if ( 'just-me' == $scope ) 177 $display_comments = 'stream'; 178 179 if ( $user_id = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id ) { 180 switch ( $scope ) { 181 case 'friends': 182 if ( function_exists( 'friends_get_friend_user_ids' ) ) 183 $user_id = implode( ',', (array)friends_get_friend_user_ids( $user_id ) ); 184 break; 185 case 'groups': 186 if ( function_exists( 'groups_get_user_groups' ) ) { 187 $groups = groups_get_user_groups( $user_id ); 188 $object = $bp->groups->id; 189 $primary_id = implode( ',', (array)$groups['groups'] ); 190 $show_hidden = ( $user_id == $bp->loggedin_user->id ) ? 1 : 0; 191 $user_id = false; 192 } 193 break; 194 case 'favorites': 195 $favs = bp_activity_get_user_favorites( $user_id ); 196 if ( empty( $favs ) ) 197 return false; 198 199 $include = implode( ',', (array)$favs ); 200 $show_hidden = ( $user_id == $bp->loggedin_user->id ) ? 1 : 0; 201 break; 202 case 'mentions': 203 $user_nicename = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->userdata->user_nicename : $bp->loggedin_user->userdata->user_nicename; 204 $user_login = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->userdata->user_login : $bp->loggedin_user->userdata->user_login; 205 $search_terms = '@' . bp_core_get_username( $user_id, $user_nicename, $user_login ); 206 $show_hidden = ( $user_id == $bp->loggedin_user->id ) ? 1 : 0; 207 $display_comments = 'stream'; 208 $user_id = false; 209 break; 210 } 211 } 212 } 213 216 214 if ( $max ) { 217 215 if ( $per_page > $max ) 218 216 $per_page = $max; -
bp-forums/bp-forums-templatetags.php
162 162 */ 163 163 $type = 'newest'; 164 164 $user_id = false; 165 $page = 1; 165 $forum_id = false; 166 $search_terms = false; 166 167 167 168 /* User filtering */ 168 if ( !empty( $bp->displayed_user->id ) || 'personal' == $_COOKIE['bp-forums-scope'])169 $user_id = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id;169 if ( !empty( $bp->displayed_user->id ) ) 170 $user_id = $bp->displayed_user->id; 170 171 171 /* Action filtering */172 if ( !empty( $_COOKIE['bp-forums-filter'] ) && '-1' != $_COOKIE['bp-forums-filter'] )173 $type = $_COOKIE['bp-forums-filter'];174 175 if ( !empty( $_COOKIE['bp-forums-page'] ) && '-1' != $_COOKIE['bp-forums-page'] )176 $page = $_COOKIE['bp-forums-page'];177 178 $defaults = array(179 'type' => $type,180 'forum_id' => false,181 'user_id' => $user_id,182 'page' => $page,183 'per_page' => 20,184 'max' => false,185 'no_stickies' => false,186 'search_terms' => false187 );188 189 $r = wp_parse_args( $args, $defaults );190 extract( $r );191 192 172 /* If we're in a single group, set this group's forum_id */ 193 173 if ( !$forum_id && $bp->groups->current_group ) { 194 174 $bp->groups->current_group->forum_id = groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' ); … … 210 190 if ( $bp->is_directory && !empty( $_GET['fs'] ) ) 211 191 $search_terms = $_GET['fs']; 212 192 213 $forum_template = new BP_Forums_Template_Forum( $type, $forum_id, $user_id, $page, $per_page, $max, $no_stickies, $search_terms ); 193 $defaults = array( 194 'type' => $type, 195 'forum_id' => $forum_id, 196 'user_id' => $user_id, 197 'page' => 1, 198 'per_page' => 20, 199 'max' => false, 200 'no_stickies' => false, 201 'search_terms' => $search_terms 202 ); 214 203 204 $r = wp_parse_args( $args, $defaults ); 205 extract( $r ); 206 207 $forum_template = new BP_Forums_Template_Forum( $type, $forum_id, $user_id, $page, $per_page, $max, $no_stickies, $search_terms ); 215 208 return apply_filters( 'bp_has_topics', $forum_template->has_topics(), &$forum_template ); 216 209 } 217 210 /* DEPRECATED use bp_has_forum_topics() */ -
bp-groups/bp-groups-templatetags.php
177 177 */ 178 178 $type = 'active'; 179 179 $user_id = false; 180 $page = 1; 180 $search_terms = false; 181 $slug = false; 181 182 182 183 /* User filtering */ 183 if ( !empty( $bp->displayed_user->id ) || 'personal' == $_COOKIE['bp-groups-scope'])184 $user_id = ( !empty( $bp->displayed_user->id ) ) ? $bp->displayed_user->id : $bp->loggedin_user->id;184 if ( !empty( $bp->displayed_user->id ) ) 185 $user_id = $bp->displayed_user->id; 185 186 186 /* Action filtering */ 187 if ( !empty( $_COOKIE['bp-groups-filter'] ) && '-1' != $_COOKIE['bp-groups-filter'] ) 188 $type = $_COOKIE['bp-groups-filter']; 187 /* Type */ 188 if ( 'my-groups' == $bp->current_action ) { 189 if ( 'recently-joined' == $order ) 190 $type = 'recently-joined'; 191 else if ( 'most-popular' == $order ) 192 $type = 'popular'; 193 else if ( 'admin-of' == $order ) { 194 $type = 'admin-of'; 195 } else if ( 'mod-of' == $order ) { 196 $type = 'mod-of'; 197 } else if ( 'alphabetically' == $order ) 198 $type = 'alphabetical'; 199 } else if ( 'invites' == $bp->current_action ) { 200 $type = 'invites'; 201 } else if ( $bp->groups->current_group->slug ) { 202 $type = 'single-group'; 203 $slug = $bp->groups->current_group->slug; 204 } 189 205 190 if ( !empty( $_COOKIE['bp-groups-page'] ) && '-1' != $_COOKIE['bp-groups-page'])191 $ page = $_COOKIE['bp-groups-page'];206 if ( isset( $_REQUEST['group-filter-box'] ) || isset( $_REQUEST['s'] ) ) 207 $search_terms = ( isset( $_REQUEST['group-filter-box'] ) ) ? $_REQUEST['group-filter-box'] : $_REQUEST['s']; 192 208 193 209 $defaults = array( 194 210 'type' => $type, 195 'page' => $page,211 'page' => 1, 196 212 'per_page' => 20, 197 213 'max' => false, 198 214 199 215 'user_id' => $user_id, // Pass a user ID to limit to groups this user has joined 200 'slug' => false, // Pass a group slug to only return that group201 'search_terms' => false// Pass search terms to return only matching groups216 'slug' => $slug, // Pass a group slug to only return that group 217 'search_terms' => $search_terms // Pass search terms to return only matching groups 202 218 ); 203 219 204 220 $r = wp_parse_args( $args, $defaults ); 205 221 extract( $r ); 206 222 207 if ( '' == $args ) {208 /* The following code will auto set parameters based on the page being viewed.209 * for example on example.com/members/andy/groups/my-groups/most-popular/210 * $type = 'most-popular'211 */212 if ( 'my-groups' == $bp->current_action ) {213 $order = $bp->action_variables[0];214 if ( 'recently-joined' == $order )215 $type = 'recently-joined';216 else if ( 'most-popular' == $order )217 $type = 'popular';218 else if ( 'admin-of' == $order ) {219 $type = 'admin-of';220 $user_id = $bp->displayed_user->id;221 } else if ( 'mod-of' == $order ) {222 $type = 'mod-of';223 $user_id = $bp->displayed_user->id;224 } else if ( 'alphabetically' == $order )225 $type = 'alphabetical';226 } else if ( 'invites' == $bp->current_action ) {227 $type = 'invites';228 } else if ( $bp->groups->current_group->slug ) {229 $type = 'single-group';230 $slug = $bp->groups->current_group->slug;231 }232 }233 234 if ( isset( $_REQUEST['group-filter-box'] ) || isset( $_REQUEST['s'] ) )235 $search_terms = ( isset( $_REQUEST['group-filter-box'] ) ) ? $_REQUEST['group-filter-box'] : $_REQUEST['s'];236 237 223 $groups_template = new BP_Groups_Template( $user_id, $type, $page, $per_page, $max, $slug, $search_terms ); 238 224 return apply_filters( 'bp_has_groups', $groups_template->has_groups(), &$groups_template ); 239 225 }