当前位置: 首页>>代码示例>>PHP>>正文


PHP Webapp类代码示例

本文整理汇总了PHP中Webapp的典型用法代码示例。如果您正苦于以下问题:PHP Webapp类的具体用法?PHP Webapp怎么用?PHP Webapp使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Webapp类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: tearDown

 /**
  * Destroy Config, Webapp, $_SESSION, $_POST, $_GET, $_REQUEST
  */
 public function tearDown()
 {
     Config::destroyInstance();
     Webapp::destroyInstance();
     Crawler::destroyInstance();
     if (isset($_SESSION)) {
         $this->unsetArray($_SESSION);
     }
     $this->unsetArray($_POST);
     $this->unsetArray($_GET);
     $this->unsetArray($_REQUEST);
     $this->unsetArray($_SERVER);
     $this->unsetArray($_FILES);
     Loader::unregister();
     $backup_dir = FileDataManager::getBackupPath();
     if (file_exists($backup_dir)) {
         try {
             @exec('cd ' . $backup_dir . '; rm -rf *');
             rmdir($backup_dir);
             // won't delete if has files
         } catch (Exception $e) {
         }
     }
     $data_dir = FileDataManager::getDataPath();
     if (file_exists($data_dir . 'compiled_view')) {
         try {
             @exec('cd ' . $data_dir . '; rm -rf compiled_view');
         } catch (Exception $e) {
         }
     }
     parent::tearDown();
 }
开发者ID:ravi-modria,项目名称:ThinkUp,代码行数:35,代码来源:class.ThinkUpBasicUnitTestCase.php

示例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++;
     }
 }
开发者ID:unruthless,项目名称:ThinkUp,代码行数:26,代码来源:TestOfExpandURLsPluginConfigurationController.php

示例3: setUp

 public function setUp()
 {
     parent::setUp();
     $webapp = Webapp::getInstance();
     $webapp->registerPlugin('googleplus', 'GooglePlusPlugin');
     $_SERVER['SERVER_NAME'] = 'dev.thinkup.com';
 }
开发者ID:rmanalan,项目名称:ThinkUp,代码行数:7,代码来源:TestOfGooglePlusPluginConfigurationController.php

示例4: setUp

 public function setUp()
 {
     parent::setUp();
     $webapp = Webapp::getInstance();
     $webapp->registerPlugin('twitter', 'TwitterPlugin');
     $webapp->registerPlugin('facebook', 'FacebookPlugin');
 }
开发者ID:randi2kewl,项目名称:ThinkUp,代码行数:7,代码来源:TestOfDashboardController.php

示例5: setUp

 public function setUp()
 {
     parent::setUp();
     $webapp = Webapp::getInstance();
     $webapp->registerPlugin('google+', 'HelloThinkUpPlugin');
     $webapp->setActivePlugin('google+');
 }
开发者ID:rmanalan,项目名称:ThinkUp,代码行数:7,代码来源:TestOfHelloThinkUpPlugin.php

示例6: 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++;
     }
 }
开发者ID:prop7,项目名称:thinktank,代码行数:27,代码来源:TestOfPrivateDashboardController.php

示例7: setUp

 public function setUp()
 {
     parent::setUp();
     $webapp = Webapp::getInstance();
     $webapp->registerPlugin('twitter', 'TwitterPlugin');
     $this->builders = self::buildData();
 }
开发者ID:raycornelius,项目名称:ThinkUp,代码行数:7,代码来源:TestOfTwitterPluginConfigurationController.php

示例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'] = '';
 }
开发者ID:NickBall,项目名称:ThinkUp,代码行数:31,代码来源:TestOfFacebookPluginConfigurationController.php

示例9: setUp

 public function setUp()
 {
     parent::setUp();
     $webapp = Webapp::getInstance();
     $webapp->registerPlugin('twitter', 'TwitterPlugin');
     $this->config = Config::getInstance();
 }
开发者ID:randi2kewl,项目名称:ThinkUp,代码行数:7,代码来源:TestOfPostController.php

示例10: 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();
         }
     }
 }
开发者ID:nix4,项目名称:ThinkUp,代码行数:36,代码来源:class.DashboardController.php

示例11: setUp

 public function  setUp() {
     parent::setUp();
     $webapp = Webapp::getInstance();
     $crawler = Crawler::getInstance();
     $webapp->registerPlugin('flickrthumbnails', 'FlickrThumbnailsPlugin');
     $crawler->registerCrawlerPlugin('FlickrThumbnailsPlugin');
 }
开发者ID:rkabir,项目名称:ThinkUp,代码行数:7,代码来源:TestOfFlickrThumbnailsPlugin.php

示例12: 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();
 }
开发者ID:nix4,项目名称:ThinkUp,代码行数:29,代码来源:class.ToggleActivePluginController.php

示例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';
 }
开发者ID:nix4,项目名称:ThinkUp,代码行数:8,代码来源:TestOfGeoEncoderPluginConfigurationController.php

示例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');
 }
开发者ID:rgoncalves,项目名称:ThinkUp,代码行数:8,代码来源:TestOfGeoEncoderPlugin.php

示例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);
 }
开发者ID:prop7,项目名称:thinktank,代码行数:11,代码来源:TestOfWebapp.php


注:本文中的Webapp类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。