/**
  * @param $user_id
  * @param $token
  * @return Socializer_Instagram
  * @internal param $params
  */
 private function inicializeInstagramSocializer($user_id, $token)
 {
     $this->load->library('Socializer/socializer');
     /* @var Socializer_Instagram $instagram */
     $instagram = Socializer::factory('Instagram', $user_id, $token);
     return $instagram;
 }
Beispiel #2
0
 public function social($social = 'facebook')
 {
     $this->load->helper('clicable_links');
     //$social = ($social === 'twitter') ? $social : 'facebook';
     $has_access = Access_token::inst()->get_by_type($social, $this->c_user->id)->exists();
     $this->template->set('has_access', $has_access);
     if ($has_access) {
         $page = max(1, intval(Arr::get($_GET, 'page', 1)));
         $per_page = 10;
         $keyword = Arr::get($_GET, 'keyword', 0);
         $keyword_query_str = $keyword ? '&keyword=' . $keyword : '';
         $keywords = Mention_keyword::inst()->dropdown($this->c_user->id);
         $use_dates = Arr::get($_GET, 'from') || Arr::get($_GET, 'to');
         $from = date('M j, Y', strtotime(Arr::get($_GET, 'from', 'yesterday')));
         $to = date('M j, Y', strtotime(Arr::get($_GET, 'to', 'today')));
         list($from, $to) = $this->getDatesFromRequest();
         $formatedFrom = $from->format($this->dateFormat);
         $formatedTo = $to->format($this->dateFormat);
         $dates = array('from' => $formatedFrom, 'to' => $formatedTo);
         $dates_query_str = '&from=' . urlencode($formatedFrom) . '&to=' . urlencode($formatedTo);
         $this->template->set('dates', $dates);
         $this->template->set('use_dates', $use_dates);
         $mentions = Mention::inst()->by_social($this->c_user->id, $social);
         if ($keyword) {
             $mentions->where('mention_keyword_id', $keyword);
         }
         $mentions->where('created_at >=', $from->getTimestamp())->where('created_at <=', $to->getTimestamp());
         $mentions->get_paged($page, $per_page);
         $keywords_for_highlight = Mention_keyword::inst()->get_for_highlight($this->c_user->id, intval($keyword));
         JsSettings::instance()->add(array('non_ajax_pagination' => true, 'keywords' => $keywords_for_highlight, 'keyword_query_str' => $keyword_query_str, 'keyword_query_id' => $keyword, 'dates_query_str' => $dates_query_str, 'dates' => $dates));
         CssJs::getInst()->c_js('social/activity', $social)->c_js();
         if ($social === 'facebook') {
             $profile_photo = User_additional::inst()->get_value($this->c_user->id, 'facebook_profile_photo');
             if (is_null($profile_photo)) {
                 try {
                     $this->load->library('Socializer/socializer');
                     $facebook = Socializer::factory('Facebook', $this->c_user->id);
                     $profile_picture = $facebook->get_profile_picture();
                     if (isset($profile_picture['picture']['data']['url'])) {
                         $profile_photo = $profile_picture['picture']['data']['url'];
                     }
                     if ($profile_photo) {
                         User_additional::inst()->set_value($this->c_user->id, 'facebook_profile_photo', $profile_photo);
                     }
                 } catch (Exception $e) {
                     $this->template->set('socializer_error', $e->getMessage());
                 }
             }
             $this->template->set('profile_photo', $profile_photo);
         }
         $this->template->set('keyword', $keyword);
         $this->template->set('keyword_query_str', $keyword_query_str);
         $this->template->set('keywords', $keywords);
         $this->template->set('mentions', $mentions);
     }
     $this->template->set('social', $social);
     $this->template->render();
 }
Beispiel #3
0
 /**
  * Get crm activities
  *
  * @param $directoryArray
  * @return array
  */
 public function getCrmActivities($directoryArray)
 {
     log_message('TASK_SUCCESS', __FUNCTION__ . ' > ' . ' called in mentioner');
     if (empty($directoryArray['instagram_link'])) {
         log_message('TASK_ERROR', __FUNCTION__ . ' > ' . 'no link for directory id=' . $directoryArray['id']);
         return;
     }
     $access_token = Access_token::getOneByTypeAndUserIdAndProfileIdAsArray('instagram', $this->userId, $this->profileId);
     /* @var Socializer_Instagram $instagram */
     $instagram = $this->socializer->factory('Instagram', $this->userId, $access_token);
     $params = array('limit' => $this->limit, 'since' => strtotime('yesterday'), 'until' => strtotime('tomorrow'));
     $params['continue_from'] = isset($directoryArray['continue_from']) ? $directoryArray['continue_from'] : null;
     $userId = $instagram->getUserFromLink($directoryArray['instagram_link']);
     if (!$userId) {
         log_message('TASK_ERROR', __FUNCTION__ . ' > ' . 'invalid username in directory id=' . $directoryArray['id']);
         return;
     }
     $result = array();
     while (true) {
         sleep(1);
         try {
             $data = $instagram->activities($userId, $params);
         } catch (Exception $e) {
             log_message('TASK_ERROR', __FUNCTION__ . ' > ' . $e->getMessage());
             $data = null;
         }
         if (!is_array($data)) {
             break;
         }
         list($parsed, $parsed_count) = $this->parseActivities($data);
         $result = array_merge($result, $parsed);
         // check if per task limit reached
         if (count($result) >= $this->maxPerRequest - $this->limit) {
             // if reached create another task
             $lastResult = end($result);
             $directoryArray['continue_from'] = $lastResult->id;
             if (!$this->test) {
                 log_message('TASK_SUCCESS', __FUNCTION__ . ' > ' . 'loop; extra queue');
                 $this->jobQueue->addJob('tasks/mentions_task/grabber', $directoryArray, array('thread' => CLI_controller::CRM_THREAD));
             }
             break;
         }
         if (count($data) < $this->limit) {
             break;
         }
     }
     log_message('TASK_SUCCESS', __FUNCTION__ . ' fetched - ' . count($result));
     return $result;
 }
Beispiel #4
0
 /**
  * Create post action
  */
 public function post_create()
 {
     if ($this->template->is_ajax()) {
         $post = $this->input->post();
         if (!empty($post['posting_type']) && $post['posting_type'] == 'schedule' && !$this->isSupportScheduledPosts) {
             $this->renderJson(array('errors' => array('when_post' => lang('when_post_error'))));
         }
         if (in_array('facebook', $post['post_to_socials'])) {
             $this->load->library('Socializer/socializer');
             /* @var Socializer_Facebook $facebook */
             $facebook = Socializer::factory('Facebook', $this->c_user->id, $this->profile->getTokenByTypeAsArray('facebook'));
             if (!$facebook->getFanpageId()) {
                 echo json_encode(array('success' => false, 'message' => lang('facebook_fanpage_error')));
                 exit;
             }
         }
         if ($this->isDemo()) {
             echo json_encode(array('success' => false, 'message' => lang('demo_version_error')));
             exit;
         }
         try {
             if (isset($post['is_cron'])) {
                 $this->add_cron_post($post);
             } else {
                 switch ($post['attachment_type']) {
                     case 'photos':
                         $this->post_photo($post);
                         break;
                     case 'videos':
                         $this->post_video($post);
                         break;
                     case 'image-designer':
                         $this->post_photo($post);
                         break;
                     default:
                         $this->post_link($post);
                         break;
                 }
             }
         } catch (Exception $e) {
             echo json_encode(array('success' => false, 'message' => $e->getMessage()));
         }
     }
 }
 /**
  * Collect info from socials
  * (get twitter followers / facebook likes count)
  *
  * @access public
  * @param $user_ids
  */
 public function statistic($user_ids)
 {
     $this->load->library('Socializer/socializer');
     foreach ($user_ids as $user_id) {
         $user = new User($user_id);
         $profiles = $user->social_group->get();
         foreach ($profiles as $profile) {
             $tokens = $profile->access_token->where_in('type', array('twitter', 'facebook', 'linkedin', 'google'))->get()->all_to_array();
             foreach ($tokens as $token) {
                 $result = 0;
                 try {
                     if ($token['type'] == 'twitter') {
                         /* @var Socializer_Twitter $twitter */
                         $twitter = Socializer::factory('Twitter', $user_id, $token);
                         $result += $twitter->get_followers_count();
                         unset($twitter);
                     } elseif ($token['type'] == 'facebook') {
                         /* @var Socializer_Facebook $facebook */
                         $facebook = Socializer::factory('Facebook', $user_id, $token);
                         $result += $facebook->get_page_likes_count();
                         unset($facebook);
                     } elseif ($token['type'] == 'linkedin') {
                         /* @var Socializer_Linkedin $linkedin */
                         $linkedin = Socializer::factory('Linkedin', $user_id, $token);
                         $result += $linkedin->get_conns_count();
                         unset($linkedin);
                     } elseif ($token['type'] == 'google') {
                         /* @var Socializer_Google $google */
                         $google = Socializer::factory('Google', $user_id, $token);
                         $result += $google->getPeopleCount();
                         unset($google);
                     }
                 } catch (Exception $e) {
                     log_message('TASK_ERROR', __FUNCTION__ . ' > ' . $e->getMessage());
                 }
                 $this->_save_values($user_id, $profile->id, $result, $token['type']);
             }
         }
     }
 }
Beispiel #6
0
 /**
  * Used to connect user to Facebook account
  * Use Socializer Library
  *
  * @access public
  *
  * @param      $planId
  * @param null $inviteCode
  */
 public function facebook($planId = null, $inviteCode = null)
 {
     try {
         $this->load->library('Socializer/socializer');
         /* @var Socializer_Facebook $facebook_socializer */
         $facebook_socializer = Socializer::factory('Facebook');
         $profile = $facebook_socializer->sign_up();
         if ($profile) {
             $email = $profile['email'];
             $user = User::findByEmail($email);
             if (!$user && $planId) {
                 $registered = $this->ion_auth->register($profile['name'], '', $email, array('first_name' => $profile['first_name'], 'last_name' => $profile['last_name']), true);
                 if ($registered) {
                     $user = new User($registered);
                     /* @var Core\Service\Subscriber\Subscriber $subscriber */
                     $subscriber = $this->get('core.subscriber');
                     $subscriber->setUser($user);
                     $plan = new Plan((int) $planId);
                     $period = $plan->getTrialPeriod();
                     $interval = new DateInterval('P' . $period->period . ucwords($period->qualifier));
                     $subscriber->addTrialSubscription($plan, $interval);
                     $this->addFlash('Registered', 'success');
                     $logged = $this->ion_auth->login($email, '', true, true);
                     if ($logged) {
                         redirect('dashboard');
                     }
                     redirect('auth/register/' . $planId . '/' . $inviteCode);
                 } else {
                     $this->addFlash('Error.');
                     redirect('auth/register/' . $planId . '/' . $inviteCode);
                 }
             } elseif (!$user) {
                 $this->addFlash('Register first. Go to <a href="http://smintly.com/#plans">Smintly</a>.');
                 redirect('auth/login');
             } else {
                 $logged = $this->ion_auth->login($email, '', true, true);
                 if ($logged) {
                     redirect('dashboard');
                 }
                 redirect('auth/register/' . $planId . '/' . $inviteCode);
             }
         }
     } catch (Exception $e) {
         $this->addFlash($e->getMessage());
         redirect('auth/register/' . $planId . '/' . $inviteCode);
     }
 }
Beispiel #7
0
 public function twfollowers()
 {
     $this->load->library('Socializer/socializer');
     $twitter = Socializer::factory('Twitter', 1);
     $followers_count = $twitter->get_followers_count();
     var_Dump($followers_count);
     exit;
 }
Beispiel #8
0
 public function getFeedHtmlData($activities)
 {
     $htmlData = '';
     if ($activities->exists()) {
         $this->load->library('Socializer/socializer');
         /* @var Socializer_Facebook $facebook */
         $facebook = Socializer::factory('Facebook', $this->c_user->id);
         $fbUserImage = $facebook->get_profile_picture();
         $wlist = Influencers_whitelist::create()->getByUser($this->c_user->id);
         foreach ($activities as $activity) {
             $social = $activity->social;
             $radar = $this->get('core.radar');
             if ($social == 'facebook') {
                 $activity->creator_image_url = $facebook->get_profile_picture($activity->creator_id);
                 $activity->user_image = $fbUserImage;
             }
             $activity->actions = in_array($social, $this->activeSocials);
             $activity->influencer = array_key_exists($activity->creator_id, $wlist) && $wlist[$activity->creator_id] == $mention->social;
             $activity->created_at = $radar->formatRadarDate($activity->created_at);
             $activity->profileUrl = $radar->getProfileUrl($activity->social);
             $content = $this->template->block('_content', '/social/webradar/blocks/' . $activity->social, array('mention' => $activity));
             $blockData = array('mention' => $activity, 'content' => $content);
             $htmlData .= $this->load->view('social/webradar/blocks/_feed', $blockData, true);
         }
     }
     return $htmlData;
 }
Beispiel #9
0
 /**
  * Return html of feed
  *
  * @return string
  */
 private function getHtmlData($mentions)
 {
     $htmlData = '';
     if ($mentions->exists()) {
         foreach ($mentions as $mention) {
             $this->load->library('Socializer/socializer');
             $access_token = Access_token::inst($mention->access_token_id)->to_array();
             /* @var Socializer_Facebook $facebook */
             $facebook = Socializer::factory('Facebook', $this->c_user->id, $access_token);
             $fbUserImage = $facebook->get_profile_picture();
             $social = $mention->social;
             $wlist = new Influencers_whitelist();
             $wlist->add($this->c_user->id, $mention->creator_id, $social);
             $radar = $this->get('core.radar');
             if ($social == 'facebook') {
                 $mention->creator_image_url = $facebook->get_profile_picture($mention->creator_id);
                 $mention->user_image = $fbUserImage;
             }
             $mention->actions = in_array($social, $this->activeSocials);
             $mention->created_at = $radar->formatRadarDate($mention->created_at);
             $mention->profileUrl = $radar->getProfileUrl($mention->social);
             $content = $this->template->block('_content', '/influencers/blocks/' . $social, array('mention' => $mention));
             $blockData = array('mention' => $mention, 'content' => $content);
             $htmlData .= $this->load->view('influencers/blocks/_feed', $blockData, true);
         }
     }
     return $htmlData;
 }
 public function index()
 {
     $this->form_validation->set_rules('first_name', 'First Name', 'required|xss_clean');
     $this->form_validation->set_rules('last_name', 'Last Name', 'required|xss_clean');
     if (isset($_POST) && !empty($_POST)) {
         $config = $this->config->config;
         if (!$config['change_settings']) {
             $this->addFlash('<span class="err_icon"></span>Demo version settings can\'t be changed');
         } else {
             $data = array('first_name' => $this->input->post('first_name'), 'last_name' => $this->input->post('last_name'));
             if ($this->input->post('old_password')) {
                 $old_password = $this->input->post('old_password');
                 $ion_model = new Ion_auth_model();
                 $valid_old = $ion_model->hash_password_db($this->c_user->id, $old_password);
                 $password_min = $this->config->item('min_password_length', 'ion_auth');
                 $password_max = $this->config->item('max_password_length', 'ion_auth');
                 $this->form_validation->set_rules('new_password', 'New Password', 'required|min_length[' . $password_min . ']|max_length[' . $password_max . ']|matches[confirm_password]');
                 $this->form_validation->set_rules('confirm_password', 'Confirm New Password', 'required');
                 if ($valid_old) {
                     $data['password'] = $this->input->post('new_password');
                 } else {
                     $this->form_validation->create_error('Invalid Old Password');
                 }
             }
             if ($this->form_validation->run() === TRUE) {
                 $update = $this->ion_auth->update($this->c_user->id, $data);
                 if ($update) {
                     $this->addFlash('Personal Settings Updated', 'success');
                     redirect('settings/personal');
                 } else {
                     $this->addFlash($this->ion_auth->errors());
                 }
             } else {
                 if (validation_errors()) {
                     $this->addFlash(validation_errors());
                 }
             }
         }
     }
     $this->template->set('email', $this->c_user->email);
     $this->template->set('first_name', $this->form_validation->set_value('first_name', $this->c_user->first_name));
     $this->template->set('last_name', $this->form_validation->set_value('last_name', $this->c_user->last_name));
     /*directories*/
     $directories = DM_Directory::get_all_sorted();
     $raw_dir_user = Directory_User::get_by_user($this->c_user->id);
     $user_directories = $raw_dir_user->to_dir_array();
     $is_notified = $raw_dir_user->isNotified();
     CssJs::getInst()->c_js();
     JsSettings::instance()->add(array('autocomplete_directories_url' => site_url('settings/directories/google_autocomplete')));
     $parsers = array();
     foreach ($directories as $_dir) {
         try {
             $parsers[$_dir->id] = Directory_Parser::factory($_dir->type);
         } catch (Exception $e) {
             $parsers[$_dir->id] = new stdClass();
         }
     }
     $receive_emails = $this->getAAC()->isGrantedPlan('email_notifications');
     $this->template->set('is_notified', $is_notified);
     $this->template->set('parsers', $parsers);
     $this->template->set('directories', $directories);
     $this->template->set('user_directories', $user_directories);
     $this->template->set('receive_emails', $receive_emails);
     /*end directories*/
     /*google keywords*/
     $this->load->config('site_config', TRUE);
     $keywords_config = $this->config->item('keywords', 'site_config');
     $keywords_count = isset($keywords_config['count']) && $keywords_config['count'] ? $keywords_config['count'] : 10;
     // get user additional info (address)
     $user_additional = User_additional::inst()->get_by_user_id($this->c_user->id);
     // get available keywords
     $keywords = Keyword::inst()->get_user_keywords($this->c_user->id);
     // escape keywords names and website name
     $address_name = isset($address_name) ? HTML::chars($address_name) : HTML::chars($user_additional->address);
     $keywords_names = isset($keywords_names) ? HTML::chars_arr($keywords_names) : HTML::chars_arr(array_values($keywords->all_to_single_array('keyword')));
     JsSettings::instance()->add(array('autocomplete_keywords_url' => site_url('settings/keywords/google_autocomplete')));
     CssJs::getInst()->c_js();
     $this->template->set('address_id', $user_additional->address_id);
     $this->template->set('address_name', $address_name);
     $this->template->set('keywords_names', $keywords_names);
     $this->template->set('keywords_count', $keywords_count);
     /*end google keywords*/
     /*socialmedia settings*/
     $this->load->library('Socializer/socializer');
     $this->load->config('timezones');
     CssJs::getInst()->c_js('settings/socialmedia', 'index')->c_js('settings/socialmedia', 'twitter');
     $tokens = new Access_token();
     $linkedin_data = $tokens->get_linkedin_token($this->c_user->id);
     $this->template->set('linkedin_token', $linkedin_data->id);
     $facebook_data = $tokens->get_facebook_token($this->c_user->id);
     if ($facebook_data->id) {
         try {
             $facebook = Socializer::factory('Facebook', $this->c_user->id);
             $user_facebook_pages = $facebook->get_user_pages();
             $this->template->set('fb_pages', $user_facebook_pages);
             $selected_fanpage = Facebook_Fanpage::inst()->get_selected_page($this->c_user->id);
             $this->template->set('selected_fanpage_id', $selected_fanpage->fanpage_id);
         } catch (Exception $e) {
             if ($e->getCode() !== Socializer::FBERRCODE) {
                 $this->addFlash($e->getMessage());
             }
         }
     }
     $this->template->set('facebook_token', $facebook_data->id);
     $twitter_data = $tokens->get_twitter_token($this->c_user->id);
     $this->template->set('twitter_token', $twitter_data->id);
     $youtube_data = $tokens->get_youtube_token($this->c_user->id);
     $this->template->set('youtube_token', $youtube_data->id);
     $google_data = $tokens->get_google_token($this->c_user->id);
     $this->template->set('google_token', $google_data->id);
     $instagram_data = $tokens->get_instagram_token($this->c_user->id);
     $this->template->set('instagram_token', $instagram_data->id);
     $timezones = $this->config->item('timezones');
     $this->template->set('timezones', $timezones);
     $current_timezone = User_timezone::get_user_timezone($this->c_user->id, TRUE);
     $this->template->set('current_timezone', $current_timezone);
     /*end socialmedia settings*/
     /*mention keywords*/
     $this->load->config('site_config', TRUE);
     $keywords_config = $this->config->item('mention_keywords', 'site_config');
     $config_count = isset($keywords_config['count']) && $keywords_config['count'] ? $keywords_config['count'] : 10;
     $availableKeywordsCount = $this->getAAC()->getPlanFeatureValue('brand_reputation_monitoring');
     if ($availableKeywordsCount) {
         $config_count = $availableKeywordsCount;
     }
     $keywords = Mention_keyword::inst()->get_user_keywords($this->c_user->id);
     JsSettings::instance()->add(array('max_keywords' => $config_count));
     CssJs::getInst()->add_js(array('libs/handlebar.js', 'libs/handlebars_helpers.js'));
     $this->template->set('keywords', $keywords);
     $this->template->set('config_count', $config_count);
     /*end mention keywords*/
     /*analytics*/
     $analyticsData = array();
     if ($this->session->flashdata('ga_redirect_to_accounts')) {
         if (!$this->access_token->token1 or !$this->access_token->token2) {
             $analyticsData['error'] = 'Please, connect your Google Analytics account.';
         } else {
             JsSettings::instance()->add(array('analytics' => array('get_accounts_url' => site_url('settings/analytics/get_accounts'))));
             CssJs::getInst()->c_js();
             $analyticsData['account_info'] = $this->access_token->account_info();
         }
     } else {
         JsSettings::instance()->add(array('analytics' => array('client_id' => $this->analytics_settings['client_id'], 'redirect_uri' => $this->analytics_settings['redirect_uri'])));
         CssJs::getInst()->c_js();
         $analyticsData['access_token'] = $this->access_token;
         $analyticsData['account_info'] = $this->access_token->account_info();
     }
     $this->template->set('analyticsData', $analyticsData);
     /*end analytics*/
     CssJs::getInst()->add_js('controller/settings/index.js');
     $this->template->render();
 }
Beispiel #11
0
 public function soc()
 {
     $types = array('facebook', 'twitter');
     foreach ($types as $type) {
         $tokens = Access_token::getAllByType($type);
         $values_array = array();
         foreach ($tokens as $_token) {
             $user_id = (int) $_token->user_id;
             $profiles = $_token->social_group->get();
             foreach ($profiles as $profile) {
                 $profile_id = $profile->id;
                 // Queue_Item::add('tasks/social_reports_task/statistic',  $args);
                 $this->load->library('Socializer/socializer');
                 if (!isset($values_array[$type])) {
                     $values_array[$type] = array();
                 }
                 if (!isset($values_array[$type][$user_id][$profile_id])) {
                     $values_array[$type][$user_id][$profile_id] = 0;
                 }
                 if ($type == 'twitter') {
                     /* @var Socializer_Twitter $twitter */
                     $twitter = Socializer::factory('Twitter', $user_id, $_token);
                     $values_array[$type][$user_id][$profile_id] += $twitter->get_followers_count();
                 } elseif ($type == 'facebook') {
                     /* @var Socializer_Facebook $facebook */
                     $facebook = Socializer::factory('Facebook', $user_id, $_token);
                     $values_array[$type][$user_id][$profile_id] += $facebook->get_page_likes_count();
                 }
             }
         }
         foreach ($values_array as $type => $values) {
             foreach ($values as $user_id => $value) {
                 foreach ($value as $profile_id => $_value) {
                     $this->_save_values($user_id, $profile_id, $_value, $type);
                 }
             }
         }
     }
 }
Beispiel #12
0
 public function postGoogle()
 {
     $this->load->library('Socializer/socializer');
     $google = Socializer::factory('Google', $this->c_user->id, Social_group::getAccountByTypeAsArray($this->profile->id, 'google')[0]);
     $google->post();
 }
Beispiel #13
0
 /**
  * Linkedin post like
  *
  * @access public
  * @return void
  */
 public function linkedin_unlike()
 {
     $this->load->library('Socializer/socializer');
     $linkedin = Socializer::factory('Linkedin', $this->c_user->id);
     $response = $linkedin->unlike();
     if ($response['linkedin'] == '') {
         $result['success'] = true;
         Social_activity::inst()->update_other_field($this->input->post('key'), 'liked', 'false');
     } else {
         $result['success'] = false;
         $result['error'] = simplexml_load_string($response['linkedin'])->message;
     }
     echo json_encode($result);
 }
Beispiel #14
0
 /**
  * Send post to Facebook
  *
  * @param $post
  * @param $user_id
  * @param $access_token
  */
 private function _send_to_facebook($post, $user_id, $access_token)
 {
     $facebook = Socializer::factory('Facebook', $user_id, $access_token);
     if (isset($post['url'])) {
         if (isset($post['image_name'])) {
             $description = $post['description'] . ' ' . $post['url'];
             $facebook->post_with_picture($description, $post['image_name'], $post['url']);
         } else {
             $facebook->post($post['description'], $post['url']);
         }
     } else {
         if (isset($post['image_name'])) {
             $facebook->post_with_picture($post['description'], $post['image_name'], null);
         } else {
             $facebook->post($post['description'], null);
         }
     }
 }
Beispiel #15
0
 /**
  * Used to connect user to Youtube(Google) account
  * Use Socializer Library
  * Add new record to 'Access tokens' and redirect to settings/socialmedia page
  *
  * @access public
  * @return void
  */
 public function google_callback()
 {
     try {
         $this->load->library('Socializer/socializer');
         /* @var Socializer_Google $google_socializer */
         $google_socializer = Socializer::factory('Google', $this->c_user->id);
         $google_socializer->add_new_account($this->profile->id);
         $this->addFlash(lang('connected_success'), 'success');
         redirect(site_url('settings/socialmedia'));
     } catch (Exception $e) {
         $this->addFlash($e->getMessage());
         redirect('settings/socialmedia');
     }
 }
Beispiel #16
0
 /**
  * @param $user_id
  * @param $token
  * @return Socializer_Twitter
  * @internal param $params
  */
 private function inicializeTwitterSocializer($user_id, $token)
 {
     $this->load->library('Socializer/socializer');
     /* @var Socializer_Twitter $twitter */
     $twitter = Socializer::factory('Twitter', $user_id, $token);
     return $twitter;
 }