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](http://codex.wordpress.org/Function_Reference/apply_filters)( 'wp_relme_silos', $silos );
        }

        public function __construct () {
                // [init](http://codex.wordpress.org/Plugin_API/Action_Reference/init) all the things!
                [add_action](http://codex.wordpress.org/Function_Reference/add_action)( '[init](http://codex.wordpress.org/Plugin_API/Action_Reference/init)', array( &$this, '[init](http://codex.wordpress.org/Plugin_API/Action_Reference/init)'));
        }

        public function [init](http://codex.wordpress.org/Plugin_API/Action_Reference/init) () {
                // additional user meta fields
                [add_filter](http://codex.wordpress.org/Function_Reference/add_filter)('[user_contactmethods](http://codex.wordpress.org/Plugin_API/Filter_Reference/user_contactmethods)', array( &$this, 'add_user_meta_fields'));
        }

        /**
         * additional user fields
         */
        public function add_user_meta_fields ($profile_fields) {

                foreach ( self::silos() as $name => $details ) {
                        $profile_fields[ $name ] = $details['display'];
                }

                return $profile_fields;
        }


        /**
         * new utils - no formatting, no html, just data
         */

        public function rel_me_list ( $author_id = 1 ) {

                $list = array();

                foreach ( self::silos() as $silo => $details ) {
                        $socialmeta = [get_the_author_meta](http://codex.wordpress.org/Function_Reference/get_the_author_meta) ( $silo , $author_id );

                        if ( !empty($socialmeta) )
                                $list[ $silo ] = sprintf ( $details['baseurl'], $socialmeta );
                }

                return $list;
        }
}

endif;