public function authControl() { $config = Config::getInstance(); Loader::definePathConstants(); $this->setViewTemplate(THINKUP_WEBAPP_PATH . 'plugins/instagram/view/instagram.account.index.tpl'); $this->view_mgr->addHelp('instagram', 'userguide/settings/plugins/instagram'); /** set option fields **/ // Application ID text field $this->addPluginOption(self::FORM_TEXT_ELEMENT, array('name' => 'instagram_app_id', 'label' => 'Client ID', 'size' => 18)); // add element // set a special required message $this->addPluginOptionRequiredMessage('instagram_app_id', 'The instagram plugin requires a valid Client ID.'); // Application Secret text field $this->addPluginOption(self::FORM_TEXT_ELEMENT, array('name' => 'instagram_api_secret', 'label' => 'Client Secret', 'size' => 37)); // add element // set a special required message $this->addPluginOptionRequiredMessage('instagram_api_secret', 'The instagram plugin requires a valid Client Secret.'); $max_crawl_time_label = 'Max crawl time in minutes'; $max_crawl_time = array('name' => 'max_crawl_time', 'label' => $max_crawl_time_label, 'default_value' => '20', 'advanced' => true, 'size' => 3); $this->addPluginOption(self::FORM_TEXT_ELEMENT, $max_crawl_time); $this->addToView('thinkup_site_url', Utils::getApplicationURL()); $instagram_plugin = new InstagramPlugin(); if ($instagram_plugin->isConfigured()) { $this->setUpInstagramInteractions($instagram_plugin->getOptionsHash()); $this->addToView('is_configured', true); } else { $this->addInfoMessage('Please complete plugin setup to start using it.', 'setup'); $this->addToView('is_configured', false); } return $this->generateView(); }
public function authControl() { $config = Config::getInstance(); Loader::definePathConstants(); $this->setViewTemplate(THINKUP_WEBAPP_PATH . 'plugins/instagram/view/instagram.account.index.tpl'); $this->view_mgr->addHelp('instagram', 'userguide/settings/plugins/instagram'); /** set option fields **/ // Application ID text field $this->addPluginOption(self::FORM_TEXT_ELEMENT, array('name' => 'instagram_app_id', 'label' => 'Client ID', 'size' => 18)); // add element // set a special required message $this->addPluginOptionRequiredMessage('instagram_app_id', 'The instagram plugin requires a valid Client ID.'); // Application Secret text field $this->addPluginOption(self::FORM_TEXT_ELEMENT, array('name' => 'instagram_api_secret', 'label' => 'Client Secret', 'size' => 37)); // add element // set a special required message $this->addPluginOptionRequiredMessage('instagram_api_secret', 'The instagram plugin requires a valid Client Secret.'); $max_api_calls_label = 'API calls per crawl (5000 max)'; $max_api_calls = array('name' => 'max_api_calls', 'label' => $max_api_calls_label, 'default_value' => '2500', 'advanced' => true, 'size' => 5); $this->addPluginOption(self::FORM_TEXT_ELEMENT, $max_api_calls); $this->addToView('thinkup_site_url', Utils::getApplicationURL()); $instagram_plugin = new InstagramPlugin(); $instance_dao = DAOFactory::getDAO('InstanceDAO'); $owner_instances = $instance_dao->getByOwnerAndNetwork($this->owner, 'instagram'); if ($instagram_plugin->isConfigured()) { $this->addToView('is_configured', true); if (isset($this->owner) && $this->owner->isMemberAtAnyLevel()) { if ($this->owner->isMemberLevel()) { if (sizeof($owner_instances) > 0) { $this->do_show_add_button = false; $this->addInfoMessage("To connect another Instagram account to ThinkUp, upgrade your " . "membership.", 'membership_cap'); } } } $this->setUpInstagramInteractions($instagram_plugin->getOptionsHash()); } else { $this->addInfoMessage('Please complete plugin setup to start using it.', 'setup'); $this->addToView('is_configured', false); } return $this->generateView(); }