relme_skeleton
if (!class_exists('WP_RELME')):
class WP_RELME {
public static function silos () {
$this->silos = array (
'github' => array (
'baseurl' => 'https://github.com/%s',
'display' => __( 'Github username', 'wp_relme' ),
),
'googleplus' => array (
'baseurl' => 'https://plus.google.com/117393351799968573179/posts',
'display' => __( 'Google+ userID or username', 'wp_relme' ),
),
'twitter' => array (
'baseurl' => 'https://twitter.com/%s',
'display' => __( 'Twitter username', 'wp_relme' ),
),
'lastfm' => array (
'baseurl' => 'last.fm/user/%s',
'display' => __( 'Last.fm username', 'wp_relme' ),
),
'flickr' => array (
'baseurl' => 'https://www.flickr.com/people/%s',
'display' => __( 'Flickr username', 'wp_relme' ),
),
);
return apply_filters( 'wp_relme_silos', $silos );
}
public function __construct () {
add_action( 'init', array( &$this, 'init'));
}
public function init () {
add_filter('user_contactmethods', array( &$this, 'add_user_meta_fields'));
}
public function add_user_meta_fields ($profile_fields) {
foreach ( self::silos() as $name => $details ) {
$profile_fields[ $name ] = $details['display'];
}
return $profile_fields;
}
public function rel_me_list ( $author_id = 1 ) {
$list = array();
foreach ( self::silos() as $silo => $details ) {
$socialmeta = get_the_author_meta ( $silo , $author_id );
if ( !empty($socialmeta) )
$list[ $silo ] = sprintf ( $details['baseurl'], $socialmeta );
}
return $list;
}
}
endif;