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


PHP View::load方法代码示例

本文整理汇总了PHP中Drupal\views\Entity\View::load方法的典型用法代码示例。如果您正苦于以下问题:PHP View::load方法的具体用法?PHP View::load怎么用?PHP View::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\views\Entity\View的用法示例。


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

示例1: testFilterUI

 /**
  * Tests the filter UI.
  */
 public function testFilterUI()
 {
     $this->drupalGet('admin/structure/views/nojs/handler/test_filter_taxonomy_index_tid/default/filter/tid');
     $result = $this->xpath('//select[@id="edit-options-value"]/option');
     // Ensure that the expected hierarchy is available in the UI.
     $counter = 0;
     for ($i = 0; $i < 3; $i++) {
         for ($j = 0; $j <= $i; $j++) {
             $option = $result[$counter++];
             $prefix = $this->terms[$i][$j]->parent->target_id ? '-' : '';
             $attributes = $option->attributes();
             $tid = (string) $attributes->value;
             $this->assertEqual($prefix . $this->terms[$i][$j]->getName(), (string) $option);
             $this->assertEqual($this->terms[$i][$j]->id(), $tid);
         }
     }
     // Ensure the autocomplete input element appears when using the 'textfield'
     // type.
     $view = View::load('test_filter_taxonomy_index_tid');
     $display =& $view->getDisplay('default');
     $display['display_options']['filters']['tid']['type'] = 'textfield';
     $view->save();
     $this->drupalGet('admin/structure/views/nojs/handler/test_filter_taxonomy_index_tid/default/filter/tid');
     $this->assertFieldByXPath('//input[@id="edit-options-value"]');
     // Tests \Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTid::calculateDependencies().
     $expected = ['config' => ['taxonomy.vocabulary.tags'], 'content' => ['taxonomy_term:tags:' . Term::load(2)->uuid()], 'module' => ['node', 'taxonomy', 'user']];
     $this->assertIdentical($expected, $view->calculateDependencies()->getDependencies());
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:31,代码来源:TaxonomyIndexTidUiTest.php

示例2: testFactoryService

 /**
  * Tests the views.executable container service.
  */
 public function testFactoryService()
 {
     $factory = $this->container->get('views.executable');
     $this->assertTrue($factory instanceof ViewExecutableFactory, 'A ViewExecutableFactory instance was returned from the container.');
     $view = View::load('test_executable_displays');
     $this->assertTrue($factory->get($view) instanceof ViewExecutable, 'A ViewExecutable instance was returned from the factory.');
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:10,代码来源:ViewExecutableTest.php

示例3: testUI

 public function testUI()
 {
     // Set up a block and a entity_test entity.
     $block = Block::create(['id' => 'test_id', 'plugin' => 'system_main_block']);
     $block->save();
     $entity_test = EntityTest::create(['bundle' => 'entity_test']);
     $entity_test->save();
     $default = $this->randomView([]);
     $id = $default['id'];
     $view = View::load($id);
     $this->drupalGet($view->urlInfo('edit-form'));
     // Add a global NULL argument to the view for testing argument placeholders.
     $this->drupalPostForm("admin/structure/views/nojs/add-handler/{$id}/page_1/argument", ['name[views.null]' => 1], 'Add and configure contextual filters');
     $this->drupalPostForm(NULL, [], 'Apply');
     // Configure both the entity_test area header and the block header to
     // reference the given entities.
     $this->drupalPostForm("admin/structure/views/nojs/add-handler/{$id}/page_1/header", ['name[views.entity_block]' => 1], 'Add and configure header');
     $this->drupalPostForm(NULL, ['options[target]' => $block->id()], 'Apply');
     $this->drupalPostForm("admin/structure/views/nojs/add-handler/{$id}/page_1/header", ['name[views.entity_entity_test]' => 1], 'Add and configure header');
     $this->drupalPostForm(NULL, ['options[target]' => $entity_test->id()], 'Apply');
     $this->drupalPostForm(NULL, [], 'Save');
     // Confirm the correct target identifiers were saved for both entities.
     $view = View::load($id);
     $header = $view->getDisplay('default')['display_options']['header'];
     $this->assertEqual(['entity_block', 'entity_entity_test'], array_keys($header));
     $this->assertEqual($block->id(), $header['entity_block']['target']);
     $this->assertEqual($entity_test->uuid(), $header['entity_entity_test']['target']);
     // Confirm that the correct serial ID (for the entity_test) and config ID
     // (for the block) are displayed in the form.
     $this->drupalGet("admin/structure/views/nojs/handler/{$id}/page_1/header/entity_block");
     $this->assertFieldByName('options[target]', $block->id());
     $this->drupalGet("admin/structure/views/nojs/handler/{$id}/page_1/header/entity_entity_test");
     $this->assertFieldByName('options[target]', $entity_test->id());
     // Replace the header target entities with argument placeholders.
     $this->drupalPostForm("admin/structure/views/nojs/handler/{$id}/page_1/header/entity_block", ['options[target]' => '{{ raw_arguments.null }}'], 'Apply');
     $this->drupalPostForm("admin/structure/views/nojs/handler/{$id}/page_1/header/entity_entity_test", ['options[target]' => '{{ raw_arguments.null }}'], 'Apply');
     $this->drupalPostForm(NULL, [], 'Save');
     // Confirm that the argument placeholders are saved.
     $view = View::load($id);
     $header = $view->getDisplay('default')['display_options']['header'];
     $this->assertEqual(['entity_block', 'entity_entity_test'], array_keys($header));
     $this->assertEqual('{{ raw_arguments.null }}', $header['entity_block']['target']);
     $this->assertEqual('{{ raw_arguments.null }}', $header['entity_entity_test']['target']);
     // Confirm that the argument placeholders are still displayed in the form.
     $this->drupalGet("admin/structure/views/nojs/handler/{$id}/page_1/header/entity_block");
     $this->assertFieldByName('options[target]', '{{ raw_arguments.null }}');
     $this->drupalGet("admin/structure/views/nojs/handler/{$id}/page_1/header/entity_entity_test");
     $this->assertFieldByName('options[target]', '{{ raw_arguments.null }}');
     // Change the targets for both headers back to the entities.
     $this->drupalPostForm("admin/structure/views/nojs/handler/{$id}/page_1/header/entity_block", ['options[target]' => $block->id()], 'Apply');
     $this->drupalPostForm("admin/structure/views/nojs/handler/{$id}/page_1/header/entity_entity_test", ['options[target]' => $entity_test->id()], 'Apply');
     $this->drupalPostForm(NULL, [], 'Save');
     // Confirm the targets were again saved correctly and not skipped based on
     // the previous form value.
     $view = View::load($id);
     $header = $view->getDisplay('default')['display_options']['header'];
     $this->assertEqual(['entity_block', 'entity_entity_test'], array_keys($header));
     $this->assertEqual($block->id(), $header['entity_block']['target']);
     $this->assertEqual($entity_test->uuid(), $header['entity_entity_test']['target']);
 }
开发者ID:sarahwillem,项目名称:OD8,代码行数:60,代码来源:AreaEntityUITest.php

示例4: testViewsPostUpdateBooleanFilterValues

 /**
  * Tests that boolean filter values are updated properly.
  */
 public function testViewsPostUpdateBooleanFilterValues()
 {
     $this->runUpdates();
     // Load and initialize our test view.
     $view = View::load('test_boolean_filter_values');
     $data = $view->toArray();
     // Check that the field is using the expected string value.
     $this->assertIdentical('1', $data['display']['default']['display_options']['filters']['status']['value']);
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:12,代码来源:BooleanFilterValuesUpdateTest.php

示例5: testViewsUpdate8004

 /**
  * Tests that field handlers are updated properly.
  */
 public function testViewsUpdate8004()
 {
     $this->runUpdates();
     // Load and initialize our test view.
     $view = View::load('test_duplicate_field_handlers');
     $data = $view->toArray();
     // Check that the field is using the expected base table.
     $this->assertEqual('node_field_data', $data['display']['default']['display_options']['fields']['nid']['table']);
     $this->assertEqual('node_field_data', $data['display']['default']['display_options']['filters']['type']['table']);
     $this->assertEqual('node_field_data', $data['display']['default']['display_options']['sorts']['vid']['table']);
     $this->assertEqual('node_field_data', $data['display']['default']['display_options']['arguments']['nid']['table']);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:15,代码来源:FieldHandlersUpdateTest.php

示例6: testTitleText

 /**
  * Tests the title area handler.
  */
 public function testTitleText()
 {
     $this->drupalGet('test-area-title');
     $this->assertTitle('test_title_header | Drupal');
     // Check the view to return no result.
     /** @var \Drupal\views\Entity\View $view */
     $view = View::load('test_area_title');
     $display =& $view->getDisplay('default');
     $display['display_options']['filters']['id'] = ['field' => 'id', 'id' => 'id', 'table' => 'views_test_data', 'relationship' => 'none', 'plugin_id' => 'numeric', 'provider' => 'views_test_data', 'value' => ['value' => '042118160112']];
     $view->save();
     $this->drupalGet('test-area-title');
     $this->assertTitle('test_title_empty | Drupal');
 }
开发者ID:anyforsoft,项目名称:csua_d8,代码行数:16,代码来源:AreaTitleWebTest.php

示例7: testFeedPage

 /**
  * Creates a feed and checks that feed's page.
  */
 public function testFeedPage()
 {
     // Increase the number of items published in the rss.xml feed so we have
     // enough articles to test paging.
     $view = View::load('frontpage');
     $display =& $view->getDisplay('feed_1');
     $display['display_options']['pager']['options']['items_per_page'] = 30;
     $view->save();
     // Create a feed with 30 items.
     $this->createSampleNodes(30);
     $feed = $this->createFeed();
     $this->updateFeedItems($feed, 30);
     // Check for presence of an aggregator pager.
     $this->drupalGet('aggregator');
     $elements = $this->xpath("//ul[contains(@class, :class)]", array(':class' => 'pager__items'));
     $this->assertTrue(!empty($elements), 'Individual source page contains a pager.');
     // Check for sources page title.
     $this->drupalGet('aggregator/sources');
     $titles = $this->xpath('//h1[normalize-space(text())=:title]', array(':title' => 'Sources'));
     $this->assertTrue(!empty($titles), 'Source page contains correct title.');
     // Find the expected read_more link on the sources page.
     $href = $feed->url();
     $links = $this->xpath('//a[@href = :href]', array(':href' => $href));
     $this->assertTrue(isset($links[0]), SafeMarkup::format('Link to href %href found.', array('%href' => $href)));
     $cache_tags_header = $this->drupalGetHeader('X-Drupal-Cache-Tags');
     $cache_tags = explode(' ', $cache_tags_header);
     $this->assertTrue(in_array('aggregator_feed:' . $feed->id(), $cache_tags));
     // Check the rss aggregator page as anonymous user.
     $this->drupalLogout();
     $this->drupalGet('aggregator/rss');
     $this->assertResponse(403);
     // Check the rss aggregator page as admin.
     $this->drupalLogin($this->adminUser);
     $this->drupalGet('aggregator/rss');
     $this->assertResponse(200);
     $this->assertEqual($this->drupalGetHeader('Content-type'), 'application/rss+xml; charset=utf-8');
     // Check the opml aggregator page.
     $this->drupalGet('aggregator/opml');
     $outline = $this->xpath('//outline[1]');
     $this->assertEqual($outline[0]['type'], 'rss', 'The correct type attribute is used for rss OPML.');
     $this->assertEqual($outline[0]['text'], $feed->label(), 'The correct text attribute is used for rss OPML.');
     $this->assertEqual($outline[0]['xmlurl'], $feed->getUrl(), 'The correct xmlUrl attribute is used for rss OPML.');
     // Check for the presence of a pager.
     $this->drupalGet('aggregator/sources/' . $feed->id());
     $elements = $this->xpath("//ul[contains(@class, :class)]", array(':class' => 'pager__items'));
     $this->assertTrue(!empty($elements), 'Individual source page contains a pager.');
     $cache_tags = explode(' ', $this->drupalGetHeader('X-Drupal-Cache-Tags'));
     $this->assertTrue(in_array('aggregator_feed:' . $feed->id(), $cache_tags));
     $this->assertTrue(in_array('aggregator_feed_view', $cache_tags));
     $this->assertTrue(in_array('aggregator_item_view', $cache_tags));
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:54,代码来源:AggregatorRenderingTest.php

示例8: testPostUpdateFunction

 /**
  * Tests post update function fixes dependencies.
  *
  * @see views_post_update_taxonomy_index_tid()
  */
 public function testPostUpdateFunction()
 {
     /** @var \Drupal\views\Entity\View $view */
     $view = View::load('test_filter_taxonomy_index_tid__non_existing_dependency');
     // Dependencies are sorted.
     $content_dependencies = [$this->terms[3]->getConfigDependencyName(), $this->terms[4]->getConfigDependencyName()];
     sort($content_dependencies);
     $this->assertEqual(['config' => ['taxonomy.vocabulary.tags'], 'content' => $content_dependencies, 'module' => ['node', 'taxonomy', 'user']], $view->calculateDependencies()->getDependencies());
     $this->terms[3]->delete();
     \Drupal::moduleHandler()->loadInclude('views', 'post_update.php');
     views_post_update_taxonomy_index_tid();
     $view = View::load('test_filter_taxonomy_index_tid__non_existing_dependency');
     $this->assertEqual(['config' => ['taxonomy.vocabulary.tags'], 'content' => [$this->terms[4]->getConfigDependencyName()], 'module' => ['node', 'taxonomy', 'user']], $view->getDependencies());
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:19,代码来源:TaxonomyIndexTidFilterTest.php

示例9: testQueryUI

 /**
  * Tests query plugins settings.
  */
 public function testQueryUI()
 {
     $view = View::load('test_view');
     $display =& $view->getDisplay('default');
     $display['display_options']['query'] = ['type' => 'query_test'];
     $view->save();
     // Save some query settings.
     $query_settings_path = "admin/structure/views/nojs/display/test_view/default/query";
     $random_value = $this->randomMachineName();
     $this->drupalPostForm($query_settings_path, array('query[options][test_setting]' => $random_value), t('Apply'));
     $this->drupalPostForm(NULL, array(), t('Save'));
     // Check that the settings are saved into the view itself.
     $view = Views::getView('test_view');
     $view->initDisplay();
     $view->initQuery();
     $this->assertEqual($random_value, $view->query->options['test_setting'], 'Query settings got saved');
 }
开发者ID:papillon-cendre,项目名称:d8,代码行数:20,代码来源:QueryTest.php

示例10: testUpdateImageStyleDependencies

 /**
  * Tests the updating of views dependencies to image styles.
  */
 public function testUpdateImageStyleDependencies()
 {
     $config_dependencies = View::load('foo')->getDependencies()['config'];
     // Checks that 'thumbnail' image style is not a dependency of view 'foo'.
     $this->assertFalse(in_array('image.style.thumbnail', $config_dependencies));
     // We test the case the the field formatter image style doesn't exist.
     // Checks that 'nonexistent' image style is not a dependency of view 'foo'.
     $this->assertFalse(in_array('image.style.nonexistent', $config_dependencies));
     // Run updates.
     $this->runUpdates();
     $config_dependencies = View::load('foo')->getDependencies()['config'];
     // Checks that 'thumbnail' image style is a dependency of view 'foo'.
     $this->assertTrue(in_array('image.style.thumbnail', $config_dependencies));
     // The 'nonexistent' style doesn't exist, thus is not a dependency. Checks
     // that 'nonexistent' image style is a not dependency of view 'foo'.
     $this->assertFalse(in_array('image.style.nonexistent', $config_dependencies));
 }
开发者ID:sojo,项目名称:d8_friendsofsilence,代码行数:20,代码来源:ImageStyleDependencyUpdateTest.php

示例11: testDependencies

 /**
  * Tests that role filter dependencies are calculated correctly.
  */
 public function testDependencies()
 {
     $role = Role::create(['id' => 'test_user_role']);
     $role->save();
     $view = View::load('test_user_name');
     $expected = ['module' => ['user']];
     $this->assertEqual($expected, $view->getDependencies());
     $display =& $view->getDisplay('default');
     $display['display_options']['filters']['roles_target_id'] = ['id' => 'roles_target_id', 'table' => 'user__roles', 'field' => 'roles_target_id', 'value' => ['test_user_role' => 'test_user_role'], 'plugin_id' => 'user_roles'];
     $view->save();
     $expected['config'][] = 'user.role.test_user_role';
     $this->assertEqual($expected, $view->getDependencies());
     $view = View::load('test_user_name');
     $display =& $view->getDisplay('default');
     $display['display_options']['filters']['roles_target_id'] = ['id' => 'roles_target_id', 'table' => 'user__roles', 'field' => 'roles_target_id', 'value' => [], 'plugin_id' => 'user_roles'];
     $view->save();
     unset($expected['config']);
     $this->assertEqual($expected, $view->getDependencies());
 }
开发者ID:HakS,项目名称:drupal8_training,代码行数:22,代码来源:HandlerFilterRolesTest.php

示例12: testCalculateDepenencies

 /**
  * @covers ::calculateDependencies
  */
 public function testCalculateDepenencies()
 {
     /** @var \Drupal\views\Entity\View $view */
     $view = View::load('test_serializer_display_entity');
     $display =& $view->getDisplay('rest_export_1');
     $display['display_options']['defaults']['style'] = FALSE;
     $display['display_options']['style']['type'] = 'serializer';
     $display['display_options']['style']['options']['formats'] = ['json', 'xml'];
     $view->save();
     $view->calculateDependencies();
     $this->assertEquals(['module' => ['rest', 'serialization', 'user']], $view->getDependencies());
     \Drupal::service('module_installer')->install(['hal']);
     $view = View::load('test_serializer_display_entity');
     $display =& $view->getDisplay('rest_export_1');
     $display['display_options']['style']['options']['formats'] = ['json', 'xml', 'hal_json'];
     $view->save();
     $view->calculateDependencies();
     $this->assertEquals(['module' => ['hal', 'rest', 'serialization', 'user']], $view->getDependencies());
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:22,代码来源:StyleSerializerKernelTest.php

示例13: testArgumentPlaceholderUpdate

 /**
  * Ensures that %1 and !1 are converted to twig tokens in existing views.
  */
 public function testArgumentPlaceholderUpdate()
 {
     $this->runUpdates();
     $view = View::load('test_token_view');
     $data = $view->toArray();
     $this->assertEqual('{{ arguments.nid }}-test-class-{{ raw_arguments.nid }}', $data['display']['default']['display_options']['style']['options']['col_class_custom']);
     $this->assertEqual('{{ arguments.nid }}-test-class-{{ raw_arguments.nid }}', $data['display']['default']['display_options']['style']['options']['row_class_custom']);
     $this->assertEqual('{{ arguments.nid }}-description-{{ raw_arguments.nid }}', $data['display']['feed_1']['display_options']['style']['options']['description']);
     $this->assertEqual('{{ arguments.nid }}-custom-text-{{ raw_arguments.nid }}', $data['display']['default']['display_options']['fields']['title']['alter']['text']);
     $this->assertEqual('test_token_view {{ arguments.nid }} {{ raw_arguments.nid }}', $data['display']['default']['display_options']['title']);
     $this->assertEqual('{{ arguments.nid }}-custom-{{ raw_arguments.nid }}', $data['display']['default']['display_options']['header']['area_text_custom']['content']);
     $this->assertEqual('{{ arguments.nid }}-text-{{ raw_arguments.nid }}', $data['display']['default']['display_options']['footer']['area']['content']['value']);
     $this->assertEqual("Displaying @start - @end of @total\n\n{{ arguments.nid }}-result-{{ raw_arguments.nid }}", $data['display']['default']['display_options']['empty']['result']['content']);
     $this->assertEqual('{{ arguments.nid }}-title-{{ raw_arguments.nid }}', $data['display']['default']['display_options']['empty']['title']['title']);
     $this->assertEqual('{{ arguments.nid }}-entity-{{ raw_arguments.nid }}', $data['display']['default']['display_options']['empty']['entity_node']['target']);
     $this->assertEqual('{{ arguments.nid }} title {{ raw_arguments.nid }}', $data['display']['default']['display_options']['arguments']['nid']['title']);
     $this->assertEqual('{{ arguments.nid }} exception-title {{ raw_arguments.nid }}', $data['display']['default']['display_options']['arguments']['nid']['exception']['title']);
     $this->assertEqual('{{ arguments.nid }}-more-text-{{ raw_arguments.nid }}', $data['display']['default']['display_options']['use_more_text']);
     $this->assertEqual('{{ arguments.nid }}-custom-url-{{ raw_arguments.nid }}', $data['display']['default']['display_options']['link_url']);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:23,代码来源:ArgumentPlaceholderUpdatePathTest.php

示例14: testImage

 /**
  * Tests integration with image module.
  */
 public function testImage()
 {
     /** @var \Drupal\image\ImageStyleInterface $style */
     $style = ImageStyle::create(['name' => 'foo']);
     $style->save();
     // Create a new image field 'bar' to be used in 'entity_test_fields' view.
     FieldStorageConfig::create(['entity_type' => 'entity_test', 'field_name' => 'bar', 'type' => 'image'])->save();
     FieldConfig::create(['entity_type' => 'entity_test', 'bundle' => 'entity_test', 'field_name' => 'bar'])->save();
     /** @var \Drupal\views\ViewEntityInterface $view */
     $view = View::load('entity_test_fields');
     $display =& $view->getDisplay('default');
     // Add the 'bar' image field to 'entity_test_fields' view.
     $display['display_options']['fields']['bar'] = ['id' => 'bar', 'field' => 'bar', 'plugin_id' => 'field', 'table' => 'entity_test__bar', 'entity_type' => 'entity_test', 'entity_field' => 'bar', 'type' => 'image', 'settings' => ['image_style' => 'foo', 'image_link' => '']];
     $view->save();
     $dependencies = $view->getDependencies() + ['config' => []];
     // Checks that style 'foo' is a dependency of view 'entity_test_fields'.
     $this->assertTrue(in_array('image.style.foo', $dependencies['config']));
     // Delete the 'foo' image style.
     $style->delete();
     // Checks that the view has been deleted too.
     $this->assertNull(View::load('entity_test_fields'));
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:25,代码来源:ViewsConfigDependenciesIntegrationTest.php

示例15: testTitleText

 /**
  * Tests the title area handler.
  */
 public function testTitleText()
 {
     // Confirm that the view has the normal title before making the view return
     // no result.
     $this->drupalGet('test-area-title');
     $this->assertTitle('test_title_header | Drupal');
     // Change the view to return no result.
     /** @var \Drupal\views\Entity\View $view */
     $view = View::load('test_area_title');
     $display =& $view->getDisplay('default');
     $display['display_options']['filters']['name'] = ['field' => 'name', 'id' => 'name', 'table' => 'views_test_data', 'relationship' => 'none', 'plugin_id' => 'string', 'value' => 'Euler'];
     $view->save();
     $this->drupalGet('test-area-title');
     $this->assertTitle('test_title_empty | Drupal');
     // Change the view to return a result instead.
     /** @var \Drupal\views\Entity\View $view */
     $view = View::load('test_area_title');
     $display =& $view->getDisplay('default');
     $display['display_options']['filters']['name'] = ['field' => 'name', 'id' => 'name', 'table' => 'views_test_data', 'relationship' => 'none', 'plugin_id' => 'string', 'value' => 'Ringo'];
     $view->save();
     $this->drupalGet('test-area-title');
     $this->assertTitle('test_title_header | Drupal');
 }
开发者ID:318io,项目名称:318-io,代码行数:26,代码来源:AreaTitleWebTest.php


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