Changeset 13901 for trunk/src/bp-core/classes/class-bp-button.php
- Timestamp:
- 06/02/2024 07:14:55 PM (20 months ago)
- File:
-
- 1 edited
-
trunk/src/bp-core/classes/class-bp-button.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/classes/class-bp-button.php
r13818 r13901 233 233 * @since 1.2.6 234 234 * 235 * @param array|string $args See {@BP_Button}.235 * @param array|string $args See `BP_Button`. 236 236 */ 237 237 public function __construct( $args = '' ) { … … 246 246 247 247 // Deprecated. Subject to removal in a future release. 248 248 249 $this->wrapper = $r['wrapper']; 249 if ( !empty( $r['link_id'] ) ) $this->link_id = ' id="' . $r['link_id'] . '"'; 250 if ( !empty( $r['link_href'] ) ) $this->link_href = ' href="' . $r['link_href'] . '"'; 251 if ( !empty( $r['link_title'] ) ) $this->link_title = ' title="' . $r['link_title'] . '"'; 252 if ( !empty( $r['link_rel'] ) ) $this->link_rel = ' rel="' . $r['link_rel'] . '"'; 253 if ( !empty( $r['link_class'] ) ) $this->link_class = ' class="' . $r['link_class'] . '"'; 254 if ( !empty( $r['link_text'] ) ) $this->link_text = $r['link_text']; 250 251 if ( ! empty( $r['link_id'] ) ) { 252 $this->link_id = ' id="' . $r['link_id'] . '"'; 253 } 254 if ( ! empty( $r['link_href'] ) ) { 255 $this->link_href = ' href="' . $r['link_href'] . '"'; 256 } 257 if ( ! empty( $r['link_title'] ) ) { 258 $this->link_title = ' title="' . $r['link_title'] . '"'; 259 } 260 if ( ! empty( $r['link_rel'] ) ) { 261 $this->link_rel = ' rel="' . $r['link_rel'] . '"'; 262 } 263 if ( ! empty( $r['link_class'] ) ) { 264 $this->link_class = ' class="' . $r['link_class'] . '"'; 265 } 266 if ( ! empty( $r['link_text'] ) ) { 267 $this->link_text = $r['link_text']; 268 } 255 269 256 270 // Required button properties. … … 262 276 // $id and $component are required and component must be active. 263 277 if ( empty( $r['id'] ) || empty( $r['component'] ) || ! bp_is_active( $this->component ) ) { 264 return false;278 return; 265 279 } 266 280 267 281 // No button for guests if must be logged in. 268 if ( true == $this->must_be_logged_in && ! is_user_logged_in() ) {269 return false;282 if ( true === $this->must_be_logged_in && ! is_user_logged_in() ) { 283 return; 270 284 } 271 285 272 286 // The block_self property. 273 if ( true == $this->block_self ) {287 if ( true === $this->block_self ) { 274 288 /* 275 289 * No button if you are the current user in a members loop. … … 279 293 */ 280 294 if ( bp_get_member_user_id() ) { 281 if ( is_user_logged_in() && bp_loggedin_user_id() == bp_get_member_user_id() ) {282 return false;295 if ( is_user_logged_in() && bp_loggedin_user_id() === bp_get_member_user_id() ) { 296 return; 283 297 } 284 298 285 // No button if viewing your own profile (and not in a members loop).299 // No button if viewing your own profile (and not in a members loop). 286 300 } elseif ( bp_is_my_profile() ) { 287 return false;301 return; 288 302 } 289 303 } … … 311 325 312 326 // Render parent element attributes. 313 $parent_elem = new BP_Core_HTML_Element( array( 314 'element' => $r['parent_element'], 315 'attr' => $r['parent_attr'] 316 ) ); 327 $parent_elem = new BP_Core_HTML_Element( 328 array( 329 'element' => $r['parent_element'], 330 'attr' => $r['parent_attr'], 331 ) 332 ); 317 333 318 334 // Set before and after. … … 320 336 $after = $parent_elem->get( 'close_tag' ); 321 337 322 // No parent element.338 // No parent element. 323 339 } else { 324 $before = $after = ''; 340 $before = ''; 341 $after = ''; 325 342 } 326 343 … … 339 356 } 340 357 341 $button = new BP_Core_HTML_Element( array( 342 'element' => $r['button_element'], 343 'attr' => $r['button_attr'], 344 'inner_html' => ! empty( $r['link_text'] ) ? $r['link_text'] : '' 345 ) ); 358 $button = new BP_Core_HTML_Element( 359 array( 360 'element' => $r['button_element'], 361 'attr' => $r['button_attr'], 362 'inner_html' => ! empty( $r['link_text'] ) ? $r['link_text'] : '', 363 ) 364 ); 346 365 $button = $button->contents(); 347 366 } … … 374 393 * @since 2.7.0. 375 394 * 376 * @param array $r See {@ linkBP_Button} class for full documentation.395 * @param array $r See {@see BP_Button} class for full documentation. 377 396 * @return array 378 397 */ … … 380 399 // Array of deprecated arguments. 381 400 $backpat_args = array( 382 'wrapper', 'wrapper_class', 'wrapper_id', 383 'link_href', 'link_class', 'link_id', 'link_rel', 'link_title' 401 'wrapper', 402 'wrapper_class', 403 'wrapper_id', 404 'link_href', 405 'link_class', 406 'link_id', 407 'link_rel', 408 'link_title', 384 409 ); 385 410 … … 389 414 } 390 415 391 $parent = $child = false; 416 $parent = false; 417 $child = false; 392 418 $sep = strpos( $prop, '_' ); 393 419 … … 410 436 $r[ "{$parent}_element" ] = $r[ $prop ]; 411 437 412 // Set attributes.438 // Set attributes. 413 439 } elseif ( true === $child ) { 414 $new_prop = substr( $prop, strpos( $prop, '_' ) + 1 );440 $new_prop = substr( $prop, strpos( $prop, '_' ) + 1 ); 415 441 if ( empty( $r[ "{$parent}_attr" ] ) ) { 416 442 $r[ "{$parent}_attr" ] = array();
Note: See TracChangeset
for help on using the changeset viewer.