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


PHP IPSLib::twitter_enabled方法代码示例

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


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

示例1: getEditorHtml

 /**
  * Returns the editor for viewing ...
  * @param unknown_type $member
  */
 public function getEditorHtml(array $member)
 {
     /* Fetch member data */
     $member = IPSMember::buildDisplayData(IPSMember::load($member['member_id'], 'all'));
     $p_w = "";
     $p_h = "";
     $cur_photo = "";
     $rand = urlencode(microtime());
     $data = array('currentPhoto' => array('tag' => ''), 'custom' => array('tag' => ''), 'gravatar' => array('tag' => ''), 'twitter' => array('tag' => ''));
     /* Photo type */
     $data['type'] = $member['pp_photo_type'] = $this->getPhotoType($member);
     /* Got gravatar? */
     $member['pp_gravatar'] = $member['pp_gravatar'] ? $member['pp_gravatar'] : $member['email'];
     /* Quick permission check */
     if (!IPSMember::canUploadPhoto($member, TRUE)) {
         return false;
     }
     /* Set the current photo */
     $data['currentPhoto']['tag'] = IPSMember::buildProfilePhoto($member, 'full', IPS_MEMBER_PHOTO_NO_CACHE);
     /* Set up custom */
     $data['custom']['tag'] = $member['pp_photo_type'] != 'custom' ? IPSMember::buildNoPhoto($member, 'thumb', false, true) : "<img src='" . $member['pp_thumb_photo'] . '?__rand=' . $rand . "' width='" . $member['pp_thumb_width'] . "' height='" . $member['pp_thumb_height'] . "' />";
     /* Set up Gravatar */
     $data['gravatar']['tag'] = "<img src='http://www.gravatar.com/avatar/" . md5($member['pp_gravatar']) . "?s=100' alt='' />";
     /* Twitter linked? */
     if (IPSLib::twitter_enabled() && $member['twitter_token'] && $member['twitter_secret']) {
         $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/twitter/connect.php', 'twitter_connect');
         $twitter = new $classToLoad($this->registry, $member['twitter_token'], $member['twitter_secret']);
         $userData = $twitter->fetchUserData();
         if ($userData['profile_image_url']) {
             $data['twitter']['tag'] = "<img src='" . str_replace('_normal.', '.', $userData['profile_image_url']) . "' />";
         }
     }
     /* Facebook linked? */
     if (IPSLib::fbc_enabled() && $member['fb_uid']) {
         $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/facebook/connect.php', 'facebook_connect');
         $facebook = new $classToLoad($this->registry);
         /* Now get the linked user */
         $linkedMemberData = IPSMember::load(intval($member['fb_uid']), 'all', 'fb_uid');
         $userData = $facebook->fetchUserData();
         if ($userData['pic_big']) {
             $data['facebook']['tag'] = "<img src='" . $userData['pic_big'] . "' />";
         } else {
             if ($userData['pic']) {
                 $data['facebook']['tag'] = "<img src='" . $userData['pic'] . "' />";
             }
         }
     }
     $this->uploadFormMax = 5000 * 1024;
     return $this->registry->getClass('output')->getTemplate('profile')->photoEditor($data, $member);
 }
开发者ID:ConnorChristie,项目名称:GrabViews,代码行数:54,代码来源:photo.php

示例2: _triggerExternalUpdates

 /**
  * Triggers external postings Twitter, etc
  *
  * @param	array		Update to...
  * @param	int			Status ID just posted
  * @param	array		[Array of member data for member updating their status - will use ->getAuthor() if null]
  * @param	string  	[Content to update]
  * @todo [Future]		At some point it could be expanded into a mini framework with plugins 
  */
 protected function _triggerExternalUpdates($updates, $status_id = 0, $author = null, $content = null)
 {
     $author = $author === null ? $this->getAuthor() : $author;
     $content = $content ? $this->_cleanContent($content) : $this->_cleanContent($this->getContent());
     /* Fail safe */
     if (!$author['member_id'] or !$content) {
         return false;
     }
     $url = $this->registry->output->buildSEOUrl('app=members&amp;module=profile&amp;section=status&amp;type=single&amp;status_id=' . $status_id, 'publicNoSession', array($author['member_id'], $author['members_seo_name']), 'members_status_single');
     /* Twitter */
     if ($updates['twitter']) {
         if (IPSLib::twitter_enabled() and $author['twitter_id']) {
             $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/twitter/connect.php', 'twitter_connect');
             $twitter = new $classToLoad($this->registry, $author['twitter_token'], $author['twitter_secret']);
             $twitter->updateStatusWithUrl($content, $url, FALSE);
         }
     }
     /* Facebook */
     if ($updates['facebook']) {
         if (IPSLib::fbc_enabled() and $author['fb_uid']) {
             $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/facebook/connect.php', 'facebook_connect');
             $facebook = new $classToLoad($this->registry);
             $facebook->updateStatusWithUrl($content, $url, FALSE);
         }
     }
 }
开发者ID:ConnorChristie,项目名称:GrabViews,代码行数:35,代码来源:status.php

示例3: saveTwitter

 /**
  * UserCP Save Form: Twitter
  *
  * @return	array	Errors
  */
 public function saveTwitter()
 {
     if (!IPSLib::twitter_enabled()) {
         $this->registry->getClass('output')->showError('twitter_disabled', 1005.2);
     }
     //-----------------------------------------
     // Data
     //-----------------------------------------
     $toSave = IPSBWOptions::thaw($this->memberData['tc_bwoptions'], 'twitter');
     //-----------------------------------------
     // Loop and save... simple
     //-----------------------------------------
     foreach (array('tc_s_pic', 'tc_s_status', 'tc_s_aboutme', 'tc_s_bgimg', 'tc_si_status') as $field) {
         $toSave[$field] = intval($this->request[$field]);
     }
     $this->memberData['tc_bwoptions'] = IPSBWOptions::freeze($toSave, 'twitter');
     $return = IPSMember::save($this->memberData['member_id'], array('extendedProfile' => array('tc_bwoptions' => $this->memberData['tc_bwoptions'])));
     //-----------------------------------------
     // Now sync
     //-----------------------------------------
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/twitter/connect.php', 'twitter_connect');
     $twitter = new $classToLoad($this->registry, $this->memberData['twitter_token'], $this->memberData['twitter_secret']);
     try {
         $twitter->syncMember($this->memberData);
     } catch (Exception $error) {
         $msg = $error->getMessage();
         switch ($msg) {
             case 'NOT_LINKED':
             case 'NO_MEMBER':
                 break;
         }
     }
     return TRUE;
 }
开发者ID:Advanture,项目名称:Online-RolePlay,代码行数:39,代码来源:usercpForms.php

示例4: _handleLogin

 /**
  * Attempt to login a user to the mobile service
  *
  * @return	string		XML
  */
 protected function _handleLogin()
 {
     /* 3.2 upwards renames these fields, but since we do this prior to getting capabilities, we don't know version yet */
     $this->request['ips_username'] = ipsRegistry::$request['ips_username'] = $this->request['username'];
     $_REQUEST['ips_username'] = $_REQUEST['username'];
     $this->request['ips_password'] = ipsRegistry::$request['ips_password'] = $this->request['password'];
     $_REQUEST['ips_password'] = $_REQUEST['password'];
     /* Load the login handler */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login');
     $this->han_login = new $classToLoad($this->registry);
     $this->han_login->init();
     /* Attempt login */
     $loginResult = $this->han_login->verifyLogin();
     /* Fail */
     if ($loginResult[2]) {
         $this->_returnError('Login Failed');
     } else {
         $this->_returnXml(array('success' => 1, 'gallery' => $this->_userHasGallery($this->han_login->member_data) ? '1' : '0', 'status' => $this->_canUpdateStatus($this->han_login->member_data) ? '1' : '0', 'notifications' => $this->_userEnabledNotifications($this->han_login->member_data) ? '1' : '0', 'facebook' => IPSLib::fbc_enabled() && $this->han_login->member_data['fb_uid'] ? '1' : '0', 'twitter' => IPSLib::twitter_enabled() && $this->han_login->member_data['twitter_id'] ? '1' : '0', 'albums' => $this->_userAlbums($this->han_login->member_data), 'version_id' => ipsRegistry::$vn_full, 'version_text' => ipsRegistry::$version, 'form_hash' => md5($this->han_login->member_data['email'] . '&' . $this->han_login->member_data['member_login_key'] . '&' . $this->han_login->member_data['joined'])));
     }
 }
开发者ID:ConnorChristie,项目名称:GrabViews,代码行数:25,代码来源:index.php

示例5: canSocialShare

 /**
  * Determines if we can share socially or not
  * @param string $method (If false, it'll check all services and return true of one or more allow it) facebook/twitter
  * @param array $memberData
  */
 public static function canSocialShare($method = false, $memberData = null)
 {
     $memberData = $memberData === null ? ipsRegistry::member()->fetchMemberData() : $memberData;
     if ($method == false) {
         $method = array('twitter', 'facebook');
     } else {
         if (is_string($method)) {
             $method = array($method);
         }
     }
     $canShare = false;
     if (is_array($method)) {
         foreach ($method as $s) {
             switch ($s) {
                 case 'twitter':
                     $canShare = (IPSLib::twitter_enabled() and $memberData['twitter_token']) ? true : false;
                     break;
                 case 'facebook':
                     $canShare = (IPSLib::fbc_enabled() and $memberData['fb_token']) ? true : false;
                     break;
             }
             if ($canShare === true) {
                 return true;
             }
         }
     }
     return $canShare;
 }
开发者ID:ConnorChristie,项目名称:GrabViews-Live,代码行数:33,代码来源:ipsMember.php

示例6: statusUpdatesPage

 function statusUpdatesPage($updates = array(), $pages = '')
 {
     $IPBHTML = "";
     if (IPSLib::locationHasHooks('skin_profile', $this->_funcHooks['statusUpdatesPage'])) {
         $count_b284dae10d4e778362b09ab9b5884953 = is_array($this->functionData['statusUpdatesPage']) ? count($this->functionData['statusUpdatesPage']) : 0;
         $this->functionData['statusUpdatesPage'][$count_b284dae10d4e778362b09ab9b5884953]['updates'] = $updates;
         $this->functionData['statusUpdatesPage'][$count_b284dae10d4e778362b09ab9b5884953]['pages'] = $pages;
     }
     $_first = reset($updates);
     if (!isset($this->registry->templateStriping['recent_status'])) {
         $this->registry->templateStriping['recent_status'] = array(FALSE, "row1", "row2 altrow");
     }
     $IPBHTML .= "" . $this->registry->getClass('output')->addJSModule("status", "0") . "<h1 class='ipsType_pagetitle'>{$this->lang->words['status_updates__overview']}</h1>\n<br />\n<div id='status_standalone_page'>\n\t<div class='maintitle ipsFilterbar'>\n\t\t<ul class='ipsList_inline'>\n\t\t\t<li id='status_all' class='" . ((!$this->request['status_id'] and !$this->request['member_id'] and !$this->request['type'] or $this->request['type'] == 'all') ? "active" : "") . "'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=profile&amp;section=status&amp;type=all", "public", ''), "true", "members_status_all") . "'>{$this->lang->words['status__all_updates']}</a></li>\n\t\t\t" . (($this->memberData['member_id'] and $this->settings['friends_enabled']) ? "<li id='status_all' class='tab_toggle " . ($this->request['type'] == 'friends' ? "active" : "") . "'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=profile&amp;section=status&amp;type=friends", "public", ''), "true", "members_status_friends") . "'>{$this->lang->words['status__myfriends']}</a></li>" : "") . "" . ($this->request['member_id'] ? "\n\t\t\t\t<li id='status_by_id' class='active'><a href='" . $this->registry->getClass('output')->formatUrl($this->registry->getClass('output')->buildUrl("app=members&amp;module=profile&amp;section=status&amp;type=memberall&amp;member_id={$this->request['member_id']}", "public", ''), array($this->request['member_id'], $_first['members_seo_name']), "members_status_member_all") . "'>{$this->lang->words['status__membersupdats']}</a></li>\n\t\t\t" : "") . "" . ($this->request['status_id'] ? "\n\t\t\t\t<li id='status_by_sid' class='active'><a href='#'>{$this->lang->words['status__singleupdate']}</a></li>\n\t\t\t" : "") . "\n\t\t</ul>\n\t</div>\n\t" . (($this->memberData['member_id'] and $this->registry->getClass('memberStatus')->canCreate($this->memberData)) ? "<div class='status_update row2'>\n\t\t\t<form id='statusForm' action='{$this->settings['base_url']}app=members&amp;module=profile&amp;section=status&amp;do=new&amp;k={$this->member->form_hash}&amp;id={$this->memberData['member_id']}' method='post'>\n\t\t\t<input type='text' id='statusUpdate_page' name='content' style='width:60%' class='input_text'> <input type='submit' class='ipsButton' id='statusSubmit_page' value='{$this->lang->words['gbl_post']}' />\n\t\t\t" . (((IPSLib::twitter_enabled() or IPSLib::fbc_enabled()) and ($this->memberData['fb_uid'] or $this->memberData['twitter_id'])) ? "<p class='desc' style='padding-top:5px;'>{$this->lang->words['st_update']}\n\t\t\t\t\t" . ((IPSLib::twitter_enabled() and $this->memberData['twitter_id']) ? "<input type='checkbox' id='su_Twitter' value='1' name='su_Twitter' /> <img src=\"{$this->settings['public_dir']}style_status/twitter.png\" style='vertical-align:top' alt='' />" : "") . "\n\t\t\t\t\t" . ((IPSLib::fbc_enabled() and $this->memberData['fb_uid']) ? "<input type='checkbox' id='su_Facebook' value='1' name='su_Facebook' /> <img src=\"{$this->settings['public_dir']}style_status/facebook.png\" style='vertical-align:top' alt='' />" : "") . "\n\t\t\t\t</p>" : "") . "\n\t\t\t</form>\n\t\t</div>" : "") . "\n\t<div id=\"status_wrapper\" class='ipsBox'>\n\t\t" . (count($updates) ? "\n\t\t\t" . (method_exists($this->registry->getClass('output')->getTemplate('profile'), 'statusUpdates') ? $this->registry->getClass('output')->getTemplate('profile')->statusUpdates($updates) : '') . "\n\t\t" : "\n\t\t\t<p class='no-status'>{$this->lang->words['status_updates_none']}</p>\n\t\t") . "\n\t</div>\n\t" . ($pages ? "\n\t\t<div class='topic_controls clearfix'>\n\t\t\t{$pages}\n\t\t</div>\n\t" : "") . "\n</div>";
     return $IPBHTML;
 }
开发者ID:ConnorChristie,项目名称:GrabViews-Live,代码行数:15,代码来源:skin_profile.php

示例7: updateStatus

 /**
  * Post a status update to twitter
  *
  * @access	public
  * @return	mixed		status id (int) successful, FALSE, #ftl
  */
 public function updateStatus($text)
 {
     if (IPSLib::twitter_enabled() && $text and $this->isConnected()) {
         $status = $this->_api->post('statuses/update', array('status' => IPSText::convertCharsets($text, IPS_DOC_CHAR_SET, 'utf-8')));
         $code = $this->_api->http_code;
         /* 200 is OK, 403 is returned if API limit is hit */
         if ($code == 200 and $status['id_str']) {
             /* Update member */
             if ($this->memberData['member_id']) {
                 /* Update member */
                 IPSMember::save($this->memberData['member_id'], array('extendedProfile' => array('tc_last_sid_import' => $status['id_str'])));
             }
             return $status['id_str'];
         } else {
             return false;
         }
     }
     return false;
 }
开发者ID:Advanture,项目名称:Online-RolePlay,代码行数:25,代码来源:connect.php

示例8: runTask

 /**
  * Run this task
  *
  * @return	@e void
  */
 public function runTask()
 {
     $counter = 0;
     $_sync = time() - 10800;
     $_active = time() - 86400 * 14;
     $members = array();
     if (IPSLib::fbc_enabled() !== TRUE && IPSLib::twitter_enabled() !== TRUE) {
         $this->class->unlockTask($this->task);
         return;
     }
     //-----------------------------------------
     // Fetch members / Edit - only complete members
     // @link http://community.invisionpower.com/tracker/issue-29269-display-names-not-always-shown-in-status-updates
     //-----------------------------------------
     $this->DB->build(array('select' => 'm.member_id', 'from' => array('members' => 'm'), 'where' => '( (m.twitter_id != \'\' AND m.tc_lastsync < ' . $_sync . ') OR (m.fb_uid > 0 AND m.fb_lastsync < ' . $_sync . ') ) AND p.partial_id ' . $this->DB->buildIsNull(true) . ' AND m.last_activity > ' . $_active, 'order' => 'm.last_visit DESC', 'limit' => array(0, 30), 'add_join' => array(array('from' => array('members_partial' => 'p'), 'where' => 'p.partial_member_id=m.member_id', 'type' => 'left'))));
     $this->DB->execute();
     while ($row = $this->DB->fetch()) {
         $members[] = $row['member_id'];
     }
     $members = IPSMember::load($members);
     foreach ($members as $member) {
         //-----------------------------------------
         // Facebook Sync
         //-----------------------------------------
         if (IPSLib::fbc_enabled() === TRUE) {
             if (!empty($member['fb_uid']) and !empty($member['fb_bwoptions'])) {
                 /* We have a linked member and options, so check if they haven't sync'd in 24 hours and have been active in the past 90 days... */
                 try {
                     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/facebook/connect.php', 'facebook_connect');
                     $facebook = new $classToLoad(ipsRegistry::instance(), null, null, true);
                     $_member = $facebook->syncMember($member, $member['fb_token'], $member['fb_uid']);
                     $counter++;
                     if ($_member and is_array($_member)) {
                         $member = $_member;
                         unset($_member);
                     }
                 } catch (Exception $error) {
                     $msg = $error->getMessage();
                     switch ($msg) {
                         case 'NOT_LINKED':
                         case 'NO_MEMBER':
                         case 'FACEBOOK_NO_APP_ID':
                             break;
                     }
                 }
             }
         }
         //-----------------------------------------
         // Twitter Sync
         //-----------------------------------------
         if (IPSLib::twitter_enabled() === TRUE) {
             if (!empty($member['twitter_id']) and !empty($member['tc_bwoptions'])) {
                 /* We have a linked member and options, so check if they haven't sync'd in 3 hours and have been active in the past 90 days... */
                 $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/twitter/connect.php', 'twitter_connect');
                 $twitter = new $classToLoad(ipsRegistry::instance());
                 try {
                     $_member = $twitter->syncMember($member);
                     $counter++;
                     if ($_member and is_array($_member)) {
                         $member = $_member;
                         unset($_member);
                     }
                 } catch (Exception $error) {
                     $msg = $error->getMessage();
                     switch ($msg) {
                         case 'NOT_LINKED':
                         case 'NO_MEMBER':
                             break;
                     }
                 }
             }
         }
     }
     //-----------------------------------------
     // Log to log table - modify but dont delete
     //-----------------------------------------
     $this->class->appendTaskLog($this->task, "Updated " . $counter);
     //-----------------------------------------
     // Unlock Task: DO NOT MODIFY!
     //-----------------------------------------
     $this->class->unlockTask($this->task);
 }
开发者ID:mover5,项目名称:imobackup,代码行数:87,代码来源:twitfacesync.php


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