public function widget($args, $instance)
 {
     extract($args);
     $instance = wp_parse_args((array) $instance, array('title' => '', 'show_connections' => true));
     $profile = wp_linkedin_get_profile('publicProfileUrl');
     if ($profile !== false) {
         $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
         $show_connections = $instance['show_connections'] ? 'true' : 'false';
         echo $before_widget;
         if ($title) {
             echo $before_title . $title . $after_title;
         }
         if (is_wp_error($profile)) {
             echo wp_linkedin_error($profile->get_error_message());
         } else {
             echo '<script src="//platform.linkedin.com/in.js" type="text/javascript"></script>';
             echo '<script type="IN/MemberProfile" data-id="' . $profile->publicProfileUrl;
             echo '" data-format="inline" data-related="' . $show_connections . '"></script>';
         }
         echo $after_widget;
     }
 }
 function field_profile()
 {
     echo '<textarea class="large-text" rows="20" readonly>';
     $fields = preg_replace('/\\s+/', '', LINKEDIN_FIELDS_BASIC . ',' . LINKEDIN_FIELDS);
     $profile = wp_linkedin_get_profile($fields, LINKEDIN_PROFILELANGUAGE);
     print_r(json_encode($profile, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
     echo '</textarea>';
 }
Example #3
0
function wp_linkedin_recommendations($atts = array())
{
    $atts = shortcode_atts(array('width' => 'auto', 'length' => '200', 'interval' => '4000'), $atts, 'li_recommendations');
    extract($atts);
    $profile = wp_linkedin_get_profile(LINKEDIN_FIELDS_RECOMMENDATIONS);
    if (is_wp_error($profile)) {
        return wp_linkedin_error($profile);
    } elseif ($profile && is_object($profile)) {
        if (isset($profile->recommendationsReceived->values) && is_array($profile->recommendationsReceived->values)) {
            return wp_linkedin_load_template('recommendations', array_merge($atts, array('recommendations' => $profile->recommendationsReceived->values)));
        } else {
            return wp_linkedin_error(__('You don\'t have any recommendation to show.', 'wp-linkedin'));
        }
    }
}