本文整理汇总了PHP中IPSLib::vkontakte_enabled方法的典型用法代码示例。如果您正苦于以下问题:PHP IPSLib::vkontakte_enabled方法的具体用法?PHP IPSLib::vkontakte_enabled怎么用?PHP IPSLib::vkontakte_enabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPSLib
的用法示例。
在下文中一共展示了IPSLib::vkontakte_enabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formVkontakte
/**
* Show the vkontakte form
*
* @author Matt Mecham
* @param string Any inline message to show
* @return string Processed HTML
*/
public function formVkontakte($inlineMsg = '')
{
//-----------------------------------------
// INIT
//-----------------------------------------
if (!IPSLib::vkontakte_enabled()) {
$this->registry->getClass('output')->showError('twitter_disabled', 1005.1);
}
//-----------------------------------------
// Twitter user logged in?
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/vkontakte/connect.php', 'vkontakte_connect');
$vkontakte = new $classToLoad($this->registry, $this->memberData['vk_token'], $this->memberData['vk_uid']);
//-----------------------------------------
// Thaw bitfield options
//-----------------------------------------
$bwOptions = IPSBWOptions::thaw($this->memberData['vk_bwoptions'], 'vkontakte');
//-----------------------------------------
// Merge..
//-----------------------------------------
if (is_array($bwOptions)) {
foreach ($bwOptions as $k => $v) {
$this->memberData[$k] = $v;
}
}
$this->hide_form_and_save_button = 1;
$userData = $vkontakte->fetchUserData();
if (isset($userData['status']['text'])) {
if (IPS_DOC_CHAR_SET != 'UTF-8') {
$userData['status']['text'] = IPSText::utf8ToEntities($userData['status']['text']);
}
}
return $this->registry->getClass('output')->getTemplate('vkontakte')->membersVkontakteConnect($this->memberData['vk_uid'], $userData);
}
示例2: setVkontaktePicture
/**
* Fetch a user's vkontakte picture
*
* @param mixed $member INT OR ARRAY
*/
public function setVkontaktePicture($member)
{
/* Fetch member details */
if (is_integer($member)) {
$member = IPSMember::load($member, 'all');
} else {
if (isset($member['member_id']) && !isset($member['pp_photo_type'])) {
$member = IPSMember::load($member['member_id'], 'all');
}
}
/* Fix up upload directory */
$paths = $this->_getProfileUploadPaths();
$upload_path = $paths['path'];
$upload_dir = $paths['dir'];
/* Vkontakte enabled? */
if (IPSLib::vkontakte_enabled() && $member['vk_token'] && $member['vk_uid']) {
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/vkontakte/connect.php', 'vkontakte_connect');
$vkontakte = new $classToLoad($this->registry, $member['vk_token'], $member['vk_uid']);
$userData = $vkontakte->fetchUserData();
if ($userData['photo']) {
$img = $userData['photo'];
$ext = IPSText::getFileExtension($img);
$file = 'photo-' . $member['member_id'] . '.' . $ext;
$mokay = false;
$content = @file_get_contents($img);
/* Try http wrappers first. Would be rude not to */
if ($content) {
if (file_put_contents($upload_path . '/' . $file, $content)) {
$mokay = true;
return $this->buildSizedPhotos($file, $member['member_id']);
}
}
/* Back up */
if ($mokay === false) {
return array('final_location' => $userData['profile_image_url'], 'final_width' => 50, 'final_height' => 50, 't_final_location' => $userData['profile_image_url'], 't_final_width' => 50, 't_final_height' => 50);
}
}
} else {
return array();
}
}