Changeset 10355 for trunk/src/bp-core/classes/class-bp-button.php
- Timestamp:
- 11/15/2015 07:13:42 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-core/classes/class-bp-button.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/classes/class-bp-button.php
r10108 r10355 144 144 public $link_text = ''; 145 145 146 /** HTML result ***********************************************************/ 147 146 /** HTML result 147 * 148 * @var string 149 */ 148 150 public $contents = ''; 149 151 … … 161 163 $r = wp_parse_args( $args, get_class_vars( __CLASS__ ) ); 162 164 163 // Required button properties 165 // Required button properties. 164 166 $this->id = $r['id']; 165 167 $this->component = $r['component']; … … 172 174 return false; 173 175 174 // No button if component is not active 176 // No button if component is not active. 175 177 if ( ! bp_is_active( $this->component ) ) 176 178 return false; 177 179 178 // No button for guests if must be logged in 180 // No button for guests if must be logged in. 179 181 if ( true == $this->must_be_logged_in && ! is_user_logged_in() ) 180 182 return false; 181 183 182 // block_self184 // The block_self property. 183 185 if ( true == $this->block_self ) { 184 186 // No button if you are the current user in a members loop 185 187 // This condition takes precedence, because members loops 186 // can be found on user profiles 188 // can be found on user profiles. 187 189 if ( bp_get_member_user_id() ) { 188 190 if ( is_user_logged_in() && bp_loggedin_user_id() == bp_get_member_user_id() ) { … … 191 193 192 194 // No button if viewing your own profile (and not in 193 // a members loop) 195 // a members loop). 194 196 } elseif ( bp_is_my_profile() ) { 195 197 return false; … … 197 199 } 198 200 199 // Wrapper properties 201 // Wrapper properties. 200 202 if ( false !== $this->wrapper ) { 201 203 202 // Wrapper ID 204 // Wrapper ID. 203 205 if ( !empty( $r['wrapper_id'] ) ) { 204 206 $this->wrapper_id = ' id="' . $r['wrapper_id'] . '"'; 205 207 } 206 208 207 // Wrapper class 209 // Wrapper class. 208 210 if ( !empty( $r['wrapper_class'] ) ) { 209 211 $this->wrapper_class = ' class="generic-button ' . $r['wrapper_class'] . '"'; … … 212 214 } 213 215 214 // Set before and after 216 // Set before and after. 215 217 $before = '<' . $r['wrapper'] . $this->wrapper_class . $this->wrapper_id . '>'; 216 218 $after = '</' . $r['wrapper'] . '>'; 217 219 218 // No wrapper 220 // No wrapper. 219 221 } else { 220 222 $before = $after = ''; 221 223 } 222 224 223 // Link properties 225 // Link properties. 224 226 if ( !empty( $r['link_id'] ) ) $this->link_id = ' id="' . $r['link_id'] . '"'; 225 227 if ( !empty( $r['link_href'] ) ) $this->link_href = ' href="' . $r['link_href'] . '"'; … … 229 231 if ( !empty( $r['link_text'] ) ) $this->link_text = $r['link_text']; 230 232 231 // Build the button 233 // Build the button. 232 234 $this->contents = $before . '<a'. $this->link_href . $this->link_title . $this->link_id . $this->link_rel . $this->link_class . '>' . $this->link_text . '</a>' . $after; 233 235
Note: See TracChangeset
for help on using the changeset viewer.