= to * * @return bool true if later site worpress version is >=, false otherwise. */ function AA_is_version( $version = '3.1' ) { global $wp_version; if ( version_compare( $wp_version, $version, '>=' ) ) { return false; } return true; } endif; if ( ! function_exists( 'AA_is_bp' ) ) : /** * Helper function which checks whether we are running buddypress * * @return bool true if we are on a system running buddypress, false otherwise. */ function AA_is_bp() { return defined( 'BP_VERSION' ) || defined( 'BP_CORE_VERSION' ); // buddypress versions < 1.0 (?) } endif; if ( ! function_exists( 'AA_is_bbpress' ) ) : /** * Helper function which checks whether we are running buddypress * * @return bool true if we are on a system running buddypress, false otherwise. */ function AA_is_bbpress() { if ( function_exists( 'is_bbpress' ) ) { return is_bbpress(); } if ( is_admin() && is_plugin_active( 'bbpress/bbpress.php' ) ) { return true; } return false; } endif; if ( ! function_exists( 'AA_in_arrayi' ) ): /** * Case insensitive version of in_array(). * * @see http://us2.php.net/manual/en/function.in-array.php#88844 * @return bool true if $needle is in $haystack, false otherwise. */ function AA_in_arrayi( $needle, $haystack ) { foreach ( $haystack as $value ) { if ( strtolower( $value ) == strtolower( $needle ) ) { return true; } } return false; } endif; if ( ! function_exists( 'AA_array_in_array' ) ) : /** * A simple function to type less when wanting to check if any one of many * values is in a single array. * * @see http://us2.php.net/manual/en/function.in-array.php#75263 * @uses in_arrayi() * @return bool true if at least one value is in both arrays, false otherwise. */ function AA_array_in_array( $needle, $haystack ) { //Make sure $needle is an array for foreach if ( ! is_array( $needle ) ) { $needle = array( $needle ); } //For each value in $needle, return TRUE if in $haystack foreach ( $needle as $pin ) { if ( AA_in_arrayi( $pin, $haystack ) ) { return true; } } //Return FALSE if none of the values from $needle are found in $haystack return false; } endif; if ( ! function_exists( 'AA_atrim' ) ) : /** * A simple implementation of "array_slice()" which preserves array keys. * * @see http://www.php.net/manual/en/function.array-slice.php#75865 * * @param $a array * @param $num number of items which to limit the array to * * @return array with $num */ function AA_atrim( $a, $num ) { while ( sizeof( $a ) > $num ) { array_pop( $a ); } return $a; } endif; if ( ! function_exists( 'AA_is_super_admin' ) ) : /** * Implementation of the function "AA_is_super_admin" if it doesn't not exists. * Needed for support of wordpress versions < 3.0. * * @param $user_id (optional) user id; defaults to current user * * @return boolean true if the supplied user is super admin (site admin) * @see http://core.trac.wordpress.org/changeset/12645 */ function AA_is_super_admin( $user_id = '' ) { $user_login = ''; if ( ! empty( $user_id ) ) { $user_info = get_userdata( $user_id ); if ( empty( $user_info->user_login ) ) { return false; } $user_login = $user_info->user_login; } return is_super_admin( $user_login ); } endif; if ( ! function_exists( 'AA_donateButton' ) ): /** * Donation button code * * @param string $type * @param bool $print * * @return string */ function AA_donateButton( $type = 'small', $print = false ) { if ( ! $print ) { ob_start(); } switch ( $type ) { case 'small': ?>
dd