base_prefix ) ) { // WPMU $prefix = $wpdb->base_prefix; } else { $prefix = $wpdb->prefix; } return $prefix . trim( $table_name ); } function aag_table_exists( $table ) { global $wpdb; return strtolower( $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) ) == strtolower( $table ); } function aag() { global $aag; if ( is_object( $aag ) ) return; $aag = (object) array( 'groups' => aag_db_table( 'groups' ), 'members' => aag_db_table( 'group_members' ), 'messages' => aag_db_table( 'group_messages' ) ); } aag(); require_once AAG_PLUGIN_DIR . '/includes/functions.php'; require_once AAG_PLUGIN_DIR . '/includes/capabilities.php'; if ( is_admin() ) require_once AAG_PLUGIN_DIR . '/admin/admin.php'; require_once AAG_PLUGIN_DIR . '/includes/widget.php'; add_action( 'init', 'aag_load_plugin_textdomain' ); function aag_load_plugin_textdomain() { load_plugin_textdomain( 'aag', false, 'acts-as-group/languages' ); } /* Install */ add_action( 'activate_' . AAG_PLUGIN_BASENAME, 'aag_install' ); function aag_install() { global $wpdb, $aag; require_once AAG_PLUGIN_DIR . '/install.php'; } /* Filters */ add_filter( 'aag_message_content', 'wptexturize' ); add_filter( 'aag_message_content', 'make_clickable' ); add_filter( 'aag_message_content', 'links_add_target' ); add_filter( 'aag_message_content', 'convert_smilies' ); add_filter( 'aag_message_content', 'aag_make_atmark_clickable' ); function aag_make_atmark_clickable( $text ) { if ( empty( $text ) ) return $text; return preg_replace_callback( '/(?<=^|\s)@([a-zA-Z0-9._-]+)(?=$|\s)/', 'aag_make_atmark_clickable_cb', $text ); } function aag_make_atmark_clickable_cb( $matches ) { $user_login = $matches[1]; if ( ! $user = get_userdatabylogin( $user_login ) ) return $matches[0]; $link_url = aag_admin_url( array( 'page' => 'aag-messages', 'author_id' => $user->ID ) ); return '@' . $matches[1] . ''; } ?>