Function Arguments

<?php

function my_function($args = ''){
$defaults = array(
'arg1' => '',
'arg2' => false
);
$r = hyp_parse_args($args,$defaults);
extract($r);
}

function hyp_parse_args($args,$defaults = ''){
if(is_object($args)) $r = get_object_vars($args);
elseif(is_array($args)) $r =& $args;
else self::hyp_parse_str($args,$r);
if(is_array($defaults)) return array_merge($defaults,$r);
return $r;
}

function hyp_parse_str($string, &$array) {
parse_str($string,$array);
if(get_magic_quotes_gpc()) $array = stripslashes_deep($array);
return $array;
}

?>

Objects for function arguments

<script type="text/javascript">

argumentObject = {arg1: "Argument One", arg2: "Argument Two", arg3: "Argument Three", arg4: "Argument Four"};

function argumentTest(objArgs){
alert(objArgs.arg1 + 'n' + objArgs.arg2 + 'n' + objArgs.arg3 + 'n' + objArgs.arg4);
}

argumentTest(argumentObject);

</script>

Swf embed shortcut function

<?php

//Here is a link to all params: http://kb2.adobe.com/cps/127/tn_12701.html
function dev_embed_swf($args = '') {
$defaults = array(
'url' => 'not set',
'width' => '550',
'height' => '440',
'wmode' => 'opaque',
'bgcolor' => '#000000',
'play' => 'true',
'loop' => 'false'
);
$r = wp_parse_args($args,$defaults);
extract($r);
?>
<div id="<?php echo str_replace('.','_',basename($url)) ?>" class="dev_embed_swf">
<object type="application/x-shockwave-flash" data="<?php echo $url ?>" width="<?php echo $width ?>" height="<?php echo $height ?>">
<param name="quality" value="high" />
<param name="wmode" value="<?php echo $wmode ?>" />
<param name="bgcolor" value="<?php echo $bgcolor ?>" />
<param name="play" value="<?php echo $play ?>" />
<param name="loop" value="<?php echo $loop ?>" />
<param name="swfversion" value="6.0.65.0" />
<param name="expressinstall" value="/Scripts/expressInstall.swf" />
<param name="movie" value="<?php echo $url ?>" />
</object>
</div>
<?php
}
?>

Omega is friend

<?php
function omega_is_friend(){
global $bp;
$friendship = false;
$user_object = wp_get_current_user();
$current_username = $user_object->user_login;
$members_id = $bp->displayed_user->id;
if(bp_has_members('type=newest&max='. $max_friends .'&user_id=' . $members_id) & is_user_logged_in()) :
while (bp_members()) : bp_the_member();
$the_friend_name = bp_get_member_user_login();
if($current_username == $the_friend_name){
$friendship = true;
return $friendship;
}
else { return $friendship; }
endwhile;
else:
return $friendship;
endif;
}
?>

Omega get profile data

<?php
// Get Profile Data
function omega_get_profile_data($user_id,$chosen_fieldname){
if (bp_has_profile('user_id=' . $user_id)) :
while (bp_profile_groups()) : bp_the_profile_group();
while (bp_profile_fields()) : bp_the_profile_field();
if (bp_field_has_data()) :
$fieldname = bp_get_the_profile_field_name();
if($fieldname == $chosen_fieldname){$return_value = strip_tags(bp_get_the_profile_field_value());}
endif;
endwhile;
endwhile;
endif;

return $return_value;
}
?>