本文整理汇总了PHP中Webapp::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Webapp::getInstance方法的具体用法?PHP Webapp::getInstance怎么用?PHP Webapp::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Webapp
的用法示例。
在下文中一共展示了Webapp::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
parent::setUp();
$webapp = Webapp::getInstance();
$webapp->registerPlugin('google+', 'TwitterRealtimePlugin');
$webapp->setActivePlugin('google+');
}
示例2: setUp
public function setUp()
{
parent::setUp();
$webapp = Webapp::getInstance();
$webapp->registerPlugin('flickr', 'ExpandURLsPlugin');
//Add owner
$q = "INSERT INTO tu_owners SET id=1, full_name='ThinkUp J. User', email='me@example.com',\n is_activated=1, pwd='XXX', activation_code='8888'";
$this->testdb_helper->runSQL($q);
//Add instance_owner
$q = "INSERT INTO tu_owner_instances (owner_id, instance_id) VALUES (1, 1)";
$this->testdb_helper->runSQL($q);
//Insert test data into test table
$q = "INSERT INTO tu_users (user_id, user_name, full_name, avatar, last_updated) VALUES (13, 'ev',\n 'Ev Williams', 'avatar.jpg', '1/1/2005');";
$this->testdb_helper->runSQL($q);
//Make public
$q = "INSERT INTO tu_instances (id, network_user_id, network_username, is_public) VALUES (1, 13, 'ev', 1);";
$this->testdb_helper->runSQL($q);
//Add a bunch of posts
$counter = 0;
while ($counter < 40) {
$pseudo_minute = str_pad($counter, 2, "0", STR_PAD_LEFT);
$q = "INSERT INTO tu_posts (post_id, author_user_id, author_username, author_fullname, author_avatar,\n post_text, source, pub_date, reply_count_cache, retweet_count_cache) VALUES ({$counter}, 13, 'ev', \n 'Ev Williams', 'avatar.jpg', 'This is post {$counter}', 'web', '2006-01-01 00:{$pseudo_minute}:00', " . rand(0, 4) . ", 5);";
$this->testdb_helper->runSQL($q);
$counter++;
}
}
示例3: setUp
/**
* Set up
* Initializes Config and Webapp objects
*/
function setUp()
{
$config = Config::getInstance();
$webapp = Webapp::getInstance();
$crawler = Crawler::getInstance();
parent::setUp();
}
示例4: setUp
public function setUp()
{
parent::setUp();
$webapp = Webapp::getInstance();
$webapp->registerPlugin('twitter', 'TwitterPlugin');
$webapp->registerPlugin('facebook', 'FacebookPlugin');
}
示例5: setUp
function setUp()
{
parent::setUp();
$webapp = Webapp::getInstance();
//TODO Make this a singleton so we don't have to instantiate/globalize it
$webapp->registerPlugin('twitter', 'TwitterPlugin');
//Add owner
$q = "INSERT INTO tt_owners SET id=1, user_name='ThinkTankUser', full_name='ThinkTank J. User', user_email='me@example.com', user_activated=1, user_pwd='XXX', activation_code='8888'";
$this->db->exec($q);
//Add instance_owner
$q = "INSERT INTO tt_owner_instances (owner_id, instance_id) VALUES (1, 1)";
$this->db->exec($q);
//Insert test data into test table
$q = "INSERT INTO tt_users (user_id, user_name, full_name, avatar, last_updated) VALUES (13, 'ev', 'Ev Williams', 'avatar.jpg', '1/1/2005');";
$this->db->exec($q);
//Make public
$q = "INSERT INTO tt_instances (id, network_user_id, network_username, is_public) VALUES (1, 13, 'ev', 1);";
$this->db->exec($q);
//Add a bunch of posts
$counter = 0;
while ($counter < 40) {
$pseudo_minute = str_pad($counter, 2, "0", STR_PAD_LEFT);
$q = "INSERT INTO tt_posts (post_id, author_user_id, author_username, author_fullname, author_avatar, post_text, source, pub_date, mention_count_cache, retweet_count_cache) VALUES ({$counter}, 13, 'ev', 'Ev Williams', 'avatar.jpg', 'This is post {$counter}', 'web', '2006-01-01 00:{$pseudo_minute}:00', " . rand(0, 4) . ", 5);";
$this->db->exec($q);
$counter++;
}
}
示例6: setUp
public function setUp()
{
parent::setUp();
$webapp = Webapp::getInstance();
$webapp->registerPlugin('twitter', 'TwitterPlugin');
$this->builders = self::buildData();
}
示例7: setUp
public function setUp()
{
parent::setUp();
$webapp = Webapp::getInstance();
$webapp->registerPlugin('googleplus', 'GooglePlusPlugin');
$_SERVER['SERVER_NAME'] = 'dev.thinkup.com';
}
示例8: setUp
/**
* Setup
*/
public function setUp()
{
parent::setUp();
$this->builders = array();
$webapp = Webapp::getInstance();
$webapp->registerPlugin('facebook', 'FacebookPlugin');
//Add owner
$owner_builder = FixtureBuilder::build('owners', array('id' => 1, 'full_name' => 'ThinkUp J. User', 'email' => 'me@example.com', 'is_activated' => 1));
array_push($this->builders, $owner_builder);
//Add instance
$instance_builder = FixtureBuilder::build('instances', array('id' => 1, 'network_user_id' => 606837591, 'network_username' => 'Gina Trapani', 'network' => 'facebook', 'is_active' => 1));
array_push($this->builders, $instance_builder);
//Add owner instance_owner
$owner_instance_builder = FixtureBuilder::build('owner_instances', array('owner_id' => 1, 'instance_id' => 1, 'oauth_access_token' => 'faux-access-token1'));
array_push($this->builders, $owner_instance_builder);
//Add second owner
$owner2_builder = FixtureBuilder::build('owners', array('id' => 2, 'full_name' => 'ThinkUp J. User 2', 'email' => 'me2@example.com', 'is_activated' => 1));
array_push($this->builders, $owner2_builder);
//Add second instance
$instance2_builder = FixtureBuilder::build('instances', array('id' => 2, 'network_user_id' => 668406218, 'network_username' => 'Penelope Caridad', 'network' => 'facebook', 'is_active' => 1));
array_push($this->builders, $instance2_builder);
//Add second owner instance_owner
$owner_instance2_builder = FixtureBuilder::build('owner_instances', array('owner_id' => 2, 'instance_id' => 2, 'oauth_access_token' => 'faux-access-token2'));
array_push($this->builders, $owner_instance2_builder);
$_SERVER['SERVER_NAME'] = 'dev.thinkup.com';
$_SERVER['HTTP_HOST'] = 'http://';
$_SERVER['REQUEST_URI'] = '';
}
示例9: adminControl
public function adminControl()
{
if (!$this->is_missing_param) {
// verify CSRF token
$this->validateCSRFToken();
$is_active = $_GET["a"] != 1 ? false : true;
$plugin_dao = DAOFactory::getDAO('PluginDAO');
$result = $plugin_dao->setActive($_GET["pid"], $is_active);
if ($result > 0) {
$plugin_folder = $plugin_dao->getPluginFolder($_GET["pid"]);
$webapp = Webapp::getInstance();
try {
$plugin_class_name = $webapp->getPluginObject($plugin_folder);
$p = new $plugin_class_name();
if ($is_active) {
$p->activate();
} else {
$p->deactivate();
}
} catch (Exception $e) {
//plugin object isn't registered, do nothing
//echo $e->getMessage();
}
}
$this->addToView('result', $result);
$this->view_mgr->clear_all_cache();
}
return $this->generateView();
}
示例10: setUp
public function setUp()
{
parent::setUp();
$webapp = Webapp::getInstance();
$webapp->registerPlugin('twitter', 'TwitterPlugin');
$this->config = Config::getInstance();
}
示例11: loadView
/**
* Load the view with required variables
*/
private function loadView()
{
$webapp = Webapp::getInstance();
if ($this->view_name == 'default') {
$this->loadDefaultDashboard();
} else {
$menu_item = $webapp->getDashboardMenuItem($this->view_name, $this->instance);
if (isset($menu_item)) {
$this->addToView('data_template', $menu_item->view_template);
$this->addToView('display', $this->view_name);
$this->addToView('header', $menu_item->name);
$this->addToView('description', $menu_item->description);
$this->addToView('parent', $menu_item->parent);
$this->setPageTitle($this->instance->network_username . ' on ' . ucfirst($this->instance->network));
$page = isset($_GET['page']) && is_numeric($_GET['page']) ? $_GET['page'] : 1;
foreach ($menu_item->datasets as $dataset) {
if (array_search('#page_number#', $dataset->method_params) !== false) {
//there's paging
$this->addToView('next_page', $page + 1);
$this->addToView('last_page', $page - 1);
}
$this->addToView($dataset->name, $dataset->retrieveDataset($page));
if (Session::isLoggedIn() && $dataset->isSearchable()) {
$view_name = 'is_searchable';
$this->addToView($view_name, true);
}
$this->view_mgr->addHelp($this->view_name, $dataset->getHelp());
}
} else {
$this->loadDefaultDashboard();
}
}
}
示例12: setUp
public function setUp() {
parent::setUp();
$webapp = Webapp::getInstance();
$crawler = Crawler::getInstance();
$webapp->registerPlugin('flickrthumbnails', 'FlickrThumbnailsPlugin');
$crawler->registerCrawlerPlugin('FlickrThumbnailsPlugin');
}
示例13: setUp
public function setUp()
{
parent::setUp();
$webapp = Webapp::getInstance();
$webapp->registerPlugin('geoencoder', 'GeoEncoderPlugin');
$_SERVER['SERVER_NAME'] = 'dev.thinkup.com';
$_SERVER['HTTP_HOST'] = 'dev.thinkup.com';
}
示例14: setUp
public function setUp() {
parent::setUp();
$this->webapp = Webapp::getInstance();
$this->webapp->registerPlugin('geoencoder', 'GeoEncoderPlugin');
$this->webapp->registerPlugin('twitter', 'TwitterPlugin');
$crawler = Crawler::getInstance();
$crawler->registerCrawlerPlugin('GeoEncoderPlugin');
}
示例15: testWebappRegisterPluginWithoutWebappInterfaceImplemented
/**
* Test registerPlugin when plugin object does not have the right methods available
*/
public function testWebappRegisterPluginWithoutWebappInterfaceImplemented()
{
$webapp = Webapp::getInstance();
$webapp->registerPlugin('hellothinktank', "HelloThinkTankPlugin");
$webapp->setActivePlugin('hellothinktank');
$this->expectException(new Exception("The HelloThinkTankPlugin object does not have a getChildTabsUnderPosts method."));
$webapp->getChildTabsUnderPosts(null);
}