function __construct($user_id, $token = null) { $this->_ci =& get_instance(); $this->_ci->config->load('social_credentials'); $mtype = $this->getMediaType(); $this->_config = Api_key::build_config('google', $this->_ci->config->item($mtype)); $this->_user_id = $user_id; $this->_google = new Google_Client(); $this->_google->setApplicationName("Script test"); $this->_google->setClientId($this->_config['client_id']); $this->_google->setClientSecret($this->_config['secret']); $this->_google->setRedirectUri($this->_config['redirect_uri']); $this->_google->setDeveloperKey($this->_config['developer_key']); $this->_google->setAccessType('offline'); if ($mtype == 'youtube') { $this->_google->setScopes(array('https://gdata.youtube.com', 'https://www.googleapis.com/auth/userinfo.profile')); } elseif ($mtype == 'google_auth' || $mtype == 'google_login') { $this->_google->setScopes(array('https://www.googleapis.com/auth/plus.login', 'https://www.googleapis.com/auth/plus.me', 'https://www.googleapis.com/auth/userinfo.email')); } else { $this->_google->setScopes(array('https://www.googleapis.com/auth/plus.login', 'https://www.googleapis.com/auth/plus.me')); } if (!$token) { $this->_token = Access_token::inst()->get_one_by_type('google', $this->_user_id)->to_array(); } else { $this->_token = $token; } }
/** * Load config and google access token model */ public function __construct() { parent::__construct($this->website_part); $this->load->config('site_config', TRUE); $analytics_keys = Api_key::build_config('google', $this->config->item('google_app', 'site_config')); $this->analytics_settings = array('client_id' => $analytics_keys['client_id'], 'client_secret' => $analytics_keys['secret'], 'redirect_uri' => site_url('settings/analytics/connect')); $this->access_token = Access_token::getByTypeAndUserId('googlea', $this->c_user->id); }
/** * Load config and google access token model */ public function __construct() { parent::__construct($this->website_part); $this->load->config('site_config', TRUE); // $this->analytics_settings = $this->config->item('google_app', 'site_config'); $this->analytics_settings = Api_key::build_config('google', $this->config->item('google_app', 'site_config')); $this->analytics_settings['client_secret'] = $this->analytics_settings['secret']; $this->analytics_settings['redirect_uri'] = site_url('settings/analytics/connect'); $this->access_token = Access_token::inst()->get_one_by_type('google', $this->c_user->id); }
/** * Load config and google access token model */ public function __construct() { parent::__construct($this->website_part); $this->piwik_settings = Api_key::build_config('piwik'); $this->lang->load('piwik_settings', $this->language); JsSettings::instance()->add(['i18n' => $this->lang->load('piwik_settings', $this->language)]); if (!empty($this->piwik_settings['domain']) && !empty($this->piwik_settings['token'])) { $this->piwik = new \VisualAppeal\Piwik($this->piwik_settings['domain'], $this->piwik_settings['token'], "all"); } }
/** * Load config and google access token model */ public function __construct() { parent::__construct($this->website_part); $this->template->set('section', 'analytics'); $this->load->config('site_config', TRUE); $this->lang->load('analytics_settings', $this->language); JsSettings::instance()->add(['i18n' => $this->lang->load('analytics_settings', $this->language)]); $analytics_keys = Api_key::build_config('google', $this->config->item('google_app', 'site_config')); $this->analytics_settings = array('client_id' => $analytics_keys['client_id'], 'client_secret' => $analytics_keys['secret'], 'redirect_uri' => site_url('settings/analytics/connect')); $this->access_token = Access_token::getByTypeAndUserIdAndProfileId('googlea', $this->c_user->id, $this->profile->id); }
/** * @param integer|null $user_id * @param array|null $token */ function __construct($user_id, $token) { $this->_ci =& get_instance(); $this->_ci->config->load('social_credentials'); $this->_config = Api_key::build_config('twitter', $this->_ci->config->item('twitter')); $this->_user_id = $user_id; if (!$token) { $this->_token = Access_token::inst()->get_one_by_type('twitter', $this->_user_id)->to_array(); } else { $this->_token = $token; } }
/** * Construct function * Sets the codeigniter instance variable and loads the lang file * @param integer|null $user_id * @param array|null $token */ function __construct($user_id, $token) { // Set the CodeIgniter instance variable $this->_ci =& get_instance(); // Load the Instagram API language file $this->_ci->config->load('social_credentials'); $this->_config = Api_key::build_config('instagram', $this->_ci->config->item('instagram')); //var_dump($this->_config);die; $this->_user_id = $user_id; $this->_token = $token; $this->access_token = $this->_token['token1']; $this->instanceId = $this->_token['instance_id']; }
/** * Method for get access to linkedin * * @access public * @param $user_id id current user * @param array|null $token * @return Socializer_Linkedin */ function __construct($user_id, $token) { $this->_ci =& get_instance(); $this->_ci->config->load('social_credentials'); $this->_config = Api_key::build_config('linkedin', $this->_ci->config->item('linkedin')); $this->_user_id = (string) $user_id; $this->_linkedin = new Linkedin($this->_config); if (!$token) { $this->_token = Access_token::inst()->get_one_by_type('linkedin', $this->_user_id)->to_array(); } else { $this->_token = $token; } }
public function __construct($params = array()) { $this->ci =& get_instance(); $this->ci->load->config('site_config', TRUE); // $this->config = $this->ci->config->item('google_app', 'site_config'); $this->config = Api_key::build_config('google', $this->ci->config->item('google_app', 'site_config')); $this->config['client_secret'] = $this->config['secret']; $this->ci->load->config('ga_queries', TRUE); $this->queries = $this->ci->config->item('queries', 'ga_queries'); $this->ci->load->library('google_analytics/ga_client'); if (isset($params['token'])) { $this->init($params['token']); } $this->default_dates = array('from' => '-1 month', 'to' => 'today'); }
/** * Grab results for single keyword * * @param $keyword_array (array) - keyword model arrayed * @throws Exception */ public function grabber($keyword_array) { try { $keyword_id = isset($keyword_array['id']) ? $keyword_array['id'] : NULL; $keyword = new Keyword($keyword_id); if (!$keyword->exists()) { throw new Exception('kwid: ' . $keyword_id . ' doesn\'t exist.'); } if ($keyword->is_deleted) { throw new Exception('kwid: ' . $keyword->id . ' is set for deletion.'); } $user_additional = User_additional::inst()->get_by_user_and_profile($keyword->user_id, $keyword->profile_id); if (!$user_additional->exists()) { throw new Exception('No user additional model for user: '******' ; kwid: ' . $keyword->id); } if (!$user_additional->address_id) { throw new Exception('No address id for user: '******'; kwid: ' . $keyword->id); } $this->load->config('site_config', TRUE); // $google_app_config = $this->config->item('google_app', 'site_config'); $google_app_config = Api_key::build_config('google', $this->config->item('google_app', 'site_config')); $this->load->library('gls'); $gls = new Gls(); // important $gls->set(array('key' => $google_app_config['developer_key'])); $gls->request($keyword->keyword); if ($gls->success()) { $rank = $gls->location_rank($user_additional->address_id); if (is_null($rank)) { throw new Exception('no results for rank. kwid: ' . $keyword->id); } $keyword_rank = new Keyword_rank(); $keyword_rank->where(array('keyword_id' => $keyword->id, 'date' => date('Y-m-d')))->get(1); $keyword_rank->keyword_id = $keyword->id; $keyword_rank->date = date('Y-m-d'); $keyword_rank->rank = intval($rank); $keyword_rank->save(); log_message('TASK_SUCCESS', __FUNCTION__ . ' > ' . 'GLS Rank grabbed for kwid: ' . $keyword->id . ' -> ' . $rank); } else { throw new Exception('Google Rank Grabber Error: ' . $gls->error()); } } catch (Exception $e) { //echo 'error: '.$e->getMessage().PHP_EOL; log_message('TASK_ERROR', __FUNCTION__ . ' > ' . $e->getMessage()); throw $e; } }
public function __construct() { parent::__construct($this->website_part); $this->lang->load('analytics', $this->language); JsSettings::instance()->add(['i18n' => $this->lang->load('analytics', $this->language)]); $config = Api_key::build_config('piwik'); $config['site_id'] = $this->c_user->ifUserHasConfigValue('piwik_site_id'); if (!empty($config['domain']) && !empty($config['token']) && !empty($config['site_id'])) { $this->piwik = new \VisualAppeal\Piwik($config['domain'], $config['token'], $config['site_id']); } $now = new \DateTime(); $to_str = $now->format($this->date_format); $now->modify('-30 days'); $from_str = $now->format($this->date_format); // default date range $this->dates = array('from' => $from_str, 'to' => $to_str); }
/** * Construct function * Sets the codeigniter instance variable and loads the lang file * @param integer|null $user_id * @param array|null $token */ function __construct($user_id, $token) { $this->_ci =& get_instance(); $this->_ci->config->load('social_credentials'); $this->_config = Api_key::build_config('facebook', $this->_ci->config->item('facebook')); $this->_user_id = $user_id; $this->_facebook = new Facebook($this->_config); $this->_token = $token; if (isset($this->_token['id'])) { $this->_facebook->destroySession(); $this->_facebook->setAccessToken($this->_token['token1']); $page = Facebook_Fanpage::inst()->get_selected_page($this->_user_id, $this->_token['id']); if ($page->id) { $this->_fanpage_id = $page->fanpage_id; $this->_profile_id = $page->profile_id; } } }
public function grank($keyword_id) { $keyword = new Keyword($keyword_id); $user_additional = User_additional::inst()->get_by_user_id($keyword->user_id); $this->load->config('site_config', TRUE); // $google_app_config = $this->config->item('google_app', 'site_config'); $google_app_config = Api_key::build_config('google', $this->config->item('google_app', 'site_config')); $gls = $this->load->library('gls'); $gls->set(array('key' => $google_app_config['developer_key'])); $gls->request($keyword->keyword); if ($gls->success()) { $rank = $gls->location_rank($user_additional->address_id); if (is_null($rank)) { throw new Exception('No results for rank'); } echo 'Rank: ' . $rank; } else { throw new Exception('Google Rank Grabber Error: ' . $gls->error()); } echo '<hr>'; echo '<pre>'; var_dump($gls->dirty()); }
public function getLocation() { $user_additional = User_additional::inst()->get_by_user_id(3); $this->load->config('site_config', TRUE); // $google_app_config = $this->config->item('google_app', 'site_config'); $google_app_config = Api_key::build_config('google', $this->config->item('google_app', 'site_config')); $this->load->library('gls'); $gls = new Gls(); // important $gls->set(array('key' => $google_app_config['developer_key'])); $gls->request('social'); if ($gls->success()) { $rank = $gls->location_rank($user_additional->address_id); echo $rank; } else { throw new Exception('Google Rank Grabber Error: ' . $gls->error()); } }
protected function piwik_load() { $piwik_config = Api_key::build_config('piwik'); if (isset($piwik_config['domain'], $piwik_config['site_id'])) { $this->template->set('piwik_enabled', true); $this->template->set('piwik_domain', $piwik_config['domain']); $this->template->set('piwik_site_id', $piwik_config['site_id']); } else { $this->template->set('piwik_enabled', false); } }