当前位置: 首页>>代码示例>>PHP>>正文


PHP LinkedIn::company方法代码示例

本文整理汇总了PHP中LinkedIn::company方法的典型用法代码示例。如果您正苦于以下问题:PHP LinkedIn::company方法的具体用法?PHP LinkedIn::company怎么用?PHP LinkedIn::company使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LinkedIn的用法示例。


在下文中一共展示了LinkedIn::company方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: SimpleXMLElement

              <input type="submit" value="Revoke Authorization" />
            </form>
            
            <hr />
      
            <h2 id="company">Company API:</h2>
            
            <hr />
            
            <h3 id="companySpecific">Specific Company:</h3>

            <p>All about LinkedIn via the Company API:</p>
            
            <?php 
                $OBJ_linkedin->setResponseFormat(LINKEDIN::_RESPONSE_XML);
                $response = $OBJ_linkedin->company('1337:(id,name,ticker,description,logo-url,locations:(address,is-headquarters))');
                if ($response['success'] === TRUE) {
                    $company = new SimpleXMLElement($response['linkedin']);
                    ?>
              <div style=""><span style="font-weight: bold;"><?php 
                    echo $company->name;
                    ?>
 (<?php 
                    echo $company->ticker;
                    ?>
)</span>&nbsp;<img src="<?php 
                    echo $company->{'logo-url'};
                    ?>
" alt="<?php 
                    echo $company->name;
                    ?>
开发者ID:rgummadi,项目名称:ScriptOverflow,代码行数:31,代码来源:company.php

示例2: elseif

 function update_linkedin_count()
 {
     // print "open linked IN update";
     if (!empty($this->transient['linkedin'])) {
         $result = $this->transient['linkedin'];
         // print "1";
     } elseif (empty($this->transient['linkedin']) && !empty($this->data) && !empty($this->options['data']['linkedin'])) {
         $result = $this->options['data']['linkedin'];
         // print "2";
     } else {
         if (!class_exists('LinkedIn')) {
             require_once ESSB_PLUGIN_ROOT . 'lib/external/linkedin/linkedin.php';
         }
         if (!class_exists('OAuthServer')) {
             require_once ESSB_PLUGIN_ROOT . 'lib/external/OAuth/OAuth.php';
         }
         $app_key = $this->options['social']['linkedin']['api'];
         $app_secret = $this->options['social']['linkedin']['apps'];
         $company_id = $this->options['social']['linkedin']['id'];
         $result = 0;
         // print "calling LinkedIn";
         $opt = array('appKey' => $app_key, 'appSecret' => $app_secret, 'callbackUrl' => '');
         $api = new LinkedIn($opt);
         $response = $api->company(trim('universal-name=' . $company_id . ':(num-followers)'));
         // print "parsing";
         // print_r($response);
         if (false !== $response['success']) {
             // print "get company";
             $company = new SimpleXMLElement($response['linkedin']);
             if (isset($company->{'num-followers'})) {
                 $result = current($company->{'num-followers'});
             }
         }
         if (!empty($result)) {
             // To update the stored data
             $this->updating_data['linkedin'] = $result;
         }
         if (empty($result) && !empty($this->options['data']['linkedin'])) {
             // Get
             // the
             // stored
             // data
             $result = $this->options['data']['linkedin'];
         }
     }
     return $result;
 }
开发者ID:ajay786singh,项目名称:emc,代码行数:47,代码来源:essb-social-fanscounter.php

示例3: us_fan_counts

 public function us_fan_counts()
 {
     header('content-type: application/json');
     $ajax_debug = UltimateSocialDeux::opt('us_ajax_debug', false);
     if (wp_verify_nonce($_REQUEST['nonce'], 'us_nonce') || $ajax_debug) {
         if (!class_exists('Requests')) {
             require_once plugin_dir_path(__FILE__) . '/includes/Requests.php';
             Requests::register_autoloader();
         }
         $args = $_REQUEST['args'] ? $_REQUEST['args'] : die('Args not set');
         $args = urldecode(stripslashes($args));
         $args = json_decode($args, true);
         $option = maybe_unserialize(get_option('us_fan_counts', array()));
         $json = array();
         $networks = explode(',', $args['networks']);
         $networks = array_keys(array_flip($networks));
         $timestamp = time();
         foreach ($networks as $key => $network) {
             $option[$network]['count'] = isset($option[$network]['count']) ? $option[$network]['count'] : 0;
             $json[$network]['count'] = $option[$network]['count'];
             $option[$network]['timestamp'] = $timestamp;
             $id = '';
             $key = '';
             $secret = '';
             $api = '';
             $app = '';
             $user = '';
             $name = '';
             $username = '';
             switch ($network) {
                 case 'facebook':
                     $app_token = UltimateSocialDeux::opt('us_facebook_token');
                     $fb_token = $app_token ? "?access_token=" . $app_token : '';
                     $id = UltimateSocialDeux::opt('us_facebook_id');
                     if ($id) {
                         $requests[$network] = array('url' => "https://graph.facebook.com/" . $id . $fb_token);
                     }
                     break;
                 case 'twitter':
                     $id = UltimateSocialDeux::opt('us_twitter_id');
                     $key = UltimateSocialDeux::opt('us_twitter_key');
                     $secret = UltimateSocialDeux::opt('us_twitter_secret');
                     if ($id && $key && $secret) {
                         $token = get_option('us_fan_count_twitter_token');
                         if (!$token) {
                             $credentials = $key . ':' . $secret;
                             $encode = base64_encode($credentials);
                             $args = array('method' => 'POST', 'httpversion' => '1.1', 'blocking' => true, 'headers' => array('Authorization' => 'Basic ' . $encode, 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8'), 'body' => array('grant_type' => 'client_credentials'));
                             add_filter('https_ssl_verify', '__return_false');
                             $response = wp_remote_post('https://api.twitter.com/oauth2/token', $args);
                             $keys = json_decode(wp_remote_retrieve_body($response));
                             if (!isset($keys->errors) && $keys) {
                                 update_option('us_fan_count_twitter_token', $keys->access_token);
                                 $token = $keys->access_token;
                             }
                         }
                         $requests[$network] = array('url' => 'https://api.twitter.com/1.1/users/show.json?screen_name=' . $id, 'headers' => array('Authorization' => "Bearer {$token}"));
                     }
                     break;
                 case 'google':
                     $id = UltimateSocialDeux::opt('us_google_id');
                     $key = UltimateSocialDeux::opt('us_google_key');
                     if ($key && $id) {
                         $requests[$network] = array('url' => "https://www.googleapis.com/plus/v1/people/" . $id . "?key=" . $key);
                     }
                     break;
                 case 'behance':
                     $id = UltimateSocialDeux::opt('us_behance_id');
                     $api = UltimateSocialDeux::opt('us_behance_api');
                     if ($id && $api) {
                         $requests[$network] = array('url' => "http://www.behance.net/v2/users/" . $id . "?api_key=" . $api);
                     }
                     break;
                 case 'delicious':
                     $id = UltimateSocialDeux::opt('us_delicious_id');
                     if ($id) {
                         $requests[$network] = array('url' => "http://feeds.delicious.com/v2/json/userinfo/" . $id);
                     }
                     break;
                 case 'linkedin':
                     $id = UltimateSocialDeux::opt('us_linkedin_id');
                     $app = UltimateSocialDeux::opt('us_linkedin_app');
                     $api = UltimateSocialDeux::opt('us_linkedin_api');
                     if (!class_exists('LinkedIn')) {
                         require_once plugin_dir_path(__FILE__) . 'includes/linkedin/linkedin.php';
                     }
                     if (!class_exists('OAuthServer')) {
                         require_once plugin_dir_path(__FILE__) . 'includes/OAuth/OAuth.php';
                     }
                     if ($id && $api && $id) {
                         $count = 0;
                         $opt = array('appKey' => $app, 'appSecret' => $api, 'callbackUrl' => '');
                         $api_call = new LinkedIn($opt);
                         $response = $api_call->company(trim('universal-name=' . $id . ':(num-followers)'));
                         if ($ajax_debug) {
                             print_r($response);
                         }
                         if (false !== $response['success']) {
                             $company = new SimpleXMLElement($response['linkedin']);
                             if (isset($company->{'num-followers'})) {
//.........这里部分代码省略.........
开发者ID:ashenkar,项目名称:sanga,代码行数:101,代码来源:class-ultimate-social-deux-ajax.php

示例4: linkedin_old

 public static function linkedin_old()
 {
     $id = ESSBSocialFansCounterHelper::get_option('linkedin.id');
     $account_type = ESSBSocialFansCounterHelper::get_option('linkedin.account_type', 'company');
     $app_key = ESSBSocialFansCounterHelper::get_option('linkedin.app_key');
     $app_secret = ESSBSocialFansCounterHelper::get_option('linkedin.app_secret');
     $oauth_token = ESSBSocialFansCounterHelper::get_option('linkedin.oauth_token');
     $oauth_token_secret = ESSBSocialFansCounterHelper::get_option('linkedin.oauth_token_secret');
     if (empty($id) || empty($app_secret) || empty($app_key) || $account_type == 'profile' && (empty($oauth_token) || empty($oauth_token_secret))) {
         return 0;
     }
     $opt = array('appKey' => $app_key, 'appSecret' => $app_secret, 'callbackUrl' => '');
     $api = new LinkedIn($opt);
     if ($account_type == 'company') {
         $response = $api->company(trim('universal-name=' . $id . ':(num-followers)'));
     } elseif ($account_type == 'group') {
         $response = $api->group($id, ':(num-members)');
     } else {
         $api->setTokenAccess(array('oauth_token' => $oauth_token, 'oauth_token_secret' => $oauth_token_secret));
         $response = $api->statistics($id);
     }
     if (false == $response['success']) {
         return false;
     }
     $xml = new SimpleXMLElement($response['linkedin']);
     $count = 0;
     if ($account_type == 'company') {
         if (isset($xml->{'num-followers'})) {
             $count = current($xml->{'num-followers'});
         }
     }
     if ($account_type == 'group') {
         if (isset($xml->{'num-members'})) {
             $count = current($xml->{'num-members'});
         }
     }
     if ($account_type == 'profile') {
         if (isset($xml->property)) {
             $count = (string) $xml->property[0];
         }
     }
     return $count;
 }
开发者ID:domalexxx,项目名称:nashvancouver,代码行数:43,代码来源:essb-social-fanscounter-updater.php


注:本文中的LinkedIn::company方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。