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


PHP get_echo函数代码示例

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


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

示例1: test_comment_meta_should_be_lazy_loaded_for_all_comments_in_comments_template

 /**
  * @ticket 16894
  */
 public function test_comment_meta_should_be_lazy_loaded_for_all_comments_in_comments_template()
 {
     global $wpdb;
     $p = $this->factory->post->create(array('post_status' => 'publish'));
     $comment_ids = $this->factory->comment->create_post_comments($p, 3);
     foreach ($comment_ids as $cid) {
         update_comment_meta($cid, 'sauce', 'fire');
     }
     $this->go_to(get_permalink($p));
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             // Load comments with `comments_template()`.
             $cform = get_echo('comments_template');
             // First request will hit the database.
             $num_queries = $wpdb->num_queries;
             get_comment_meta($comment_ids[0], 'sauce');
             $this->assertSame($num_queries + 1, $wpdb->num_queries);
             // Second and third requests should be in cache.
             get_comment_meta($comment_ids[1], 'sauce');
             get_comment_meta($comment_ids[2], 'sauce');
             $this->assertSame($num_queries + 1, $wpdb->num_queries);
         }
     }
 }
开发者ID:plis197715,项目名称:wordpress-develop,代码行数:28,代码来源:metaCache.php

示例2: test_the_excerpt_password_protected_post

 /**
  * @ticket 27246
  * @ticket 35486
  */
 public function test_the_excerpt_password_protected_post()
 {
     $post = self::factory()->post->create_and_get(array('post_excerpt' => 'Post excerpt', 'post_password' => '1234'));
     $this->assertSame('There is no excerpt because this is a protected post.', get_the_excerpt($post));
     $GLOBALS['post'] = $post;
     $this->assertSame("<p>There is no excerpt because this is a protected post.</p>\n", get_echo('the_excerpt'));
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:11,代码来源:getTheExcerpt.php

示例3: test_protocols

 /**
  * Test the different protocol references in wp_enqueue_style
  * @global WP_Styles $wp_styles
  * @ticket 16560
  */
 public function test_protocols()
 {
     // Init
     global $wp_styles;
     $base_url_backup = $wp_styles->base_url;
     $wp_styles->base_url = 'http://example.com/wordpress';
     $expected = '';
     $ver = get_bloginfo('version');
     // Try with an HTTP reference
     wp_enqueue_style('reset-css-http', 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css');
     $expected .= "<link rel='stylesheet' id='reset-css-http-css'  href='http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver={$ver}' type='text/css' media='all' />\n";
     // Try with an HTTPS reference
     wp_enqueue_style('reset-css-https', 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css');
     $expected .= "<link rel='stylesheet' id='reset-css-https-css'  href='http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver={$ver}' type='text/css' media='all' />\n";
     // Try with an automatic protocol reference (//)
     wp_enqueue_style('reset-css-doubleslash', '//yui.yahooapis.com/2.8.1/build/reset/reset-min.css');
     $expected .= "<link rel='stylesheet' id='reset-css-doubleslash-css'  href='//yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver={$ver}' type='text/css' media='all' />\n";
     // Try with a local resource and an automatic protocol reference (//)
     $url = '//my_plugin/style.css';
     wp_enqueue_style('plugin-style', $url);
     $expected .= "<link rel='stylesheet' id='plugin-style-css'  href='{$url}?ver={$ver}' type='text/css' media='all' />\n";
     // Try with a bad protocol
     wp_enqueue_style('reset-css-ftp', 'ftp://yui.yahooapis.com/2.8.1/build/reset/reset-min.css');
     $expected .= "<link rel='stylesheet' id='reset-css-ftp-css'  href='{$wp_styles->base_url}ftp://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver={$ver}' type='text/css' media='all' />\n";
     // Go!
     $this->assertEquals($expected, get_echo('wp_print_styles'));
     // No styles left to print
     $this->assertEquals('', get_echo('wp_print_styles'));
     // Cleanup
     $wp_styles->base_url = $base_url_backup;
 }
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:36,代码来源:styles.php

示例4: test_protocols

 /**
  * Test the different protocol references in wp_enqueue_script
  * @global WP_Scripts $wp_scripts
  * @ticket 16560
  */
 public function test_protocols()
 {
     // Init
     global $wp_scripts;
     $base_url_backup = $wp_scripts->base_url;
     $wp_scripts->base_url = 'http://example.com/wordpress';
     $expected = '';
     $ver = get_bloginfo('version');
     // Try with an HTTP reference
     wp_enqueue_script('jquery-http', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
     $expected .= "<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver={$ver}'></script>\n";
     // Try with an HTTPS reference
     wp_enqueue_script('jquery-https', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
     $expected .= "<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver={$ver}'></script>\n";
     // Try with an automatic protocol reference (//)
     wp_enqueue_script('jquery-doubleslash', '//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
     $expected .= "<script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver={$ver}'></script>\n";
     // Try with a local resource and an automatic protocol reference (//)
     $url = '//my_plugin/script.js';
     wp_enqueue_script('plugin-script', $url);
     $expected .= "<script type='text/javascript' src='{$url}?ver={$ver}'></script>\n";
     // Try with a bad protocol
     wp_enqueue_script('jquery-ftp', 'ftp://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
     $expected .= "<script type='text/javascript' src='{$wp_scripts->base_url}ftp://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver={$ver}'></script>\n";
     // Go!
     $this->assertEquals($expected, get_echo('wp_print_scripts'));
     // No scripts left to print
     $this->assertEquals('', get_echo('wp_print_scripts'));
     // Cleanup
     $wp_scripts->base_url = $base_url_backup;
 }
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:36,代码来源:scripts.php

示例5: test_checked_publish_with_no_update_and_no_new

 function test_checked_publish_with_no_update_and_no_new()
 {
     update_option('webpush_triggers', array());
     $admin = new WebPush_Admin();
     $post = new WP_Post((object) array('post_status' => 'publish'));
     $box = get_echo(array($admin, 'meta_box'), array($post));
     $this->assertNotContains('checked', $box);
 }
开发者ID:mozilla,项目名称:wp-web-push,代码行数:8,代码来源:test-admin-meta-box.php

示例6: test_the_taxonomies_term_template

 /**
  * @group 27238
  */
 function test_the_taxonomies_term_template()
 {
     $post_id = $this->factory->post->create();
     $output = get_echo('the_taxonomies', array(array('post' => $post_id, 'term_template' => '%2$s')));
     $this->assertEquals('Categories: Uncategorized.', $output);
     $output = get_echo('the_taxonomies', array(array('post' => $post_id, 'term_template' => '<span class="foo"><a href="%1$s">%2$s</a></span>')));
     $link = get_category_link(1);
     $this->assertEquals('Categories: <span class="foo"><a href="' . $link . '">Uncategorized</a></span>.', $output);
 }
开发者ID:Benrajalu,项目名称:philRaj,代码行数:12,代码来源:taxonomy.php

示例7: test_maybe_run_ajax_cache_should_return_javascript

 public function test_maybe_run_ajax_cache_should_return_javascript()
 {
     $GLOBALS['post'] = $this->factory()->post->create_and_get(array('post_title' => 'Hello World'));
     $_GET['message'] = 'foo';
     $url = admin_url('admin-ajax.php?action=oembed-cache&post=' . $GLOBALS['post']->ID, 'relative');
     $actual = get_echo(array($this->wp_embed, 'maybe_run_ajax_cache'));
     unset($GLOBALS['post']);
     unset($GLOBALS['message']);
     $this->assertContains($url, $actual);
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:10,代码来源:WpEmbed.php

示例8: test_search_returns_results_for_pages

 /**
  * @ticket 27042
  */
 public function test_search_returns_results_for_pages()
 {
     include_once ABSPATH . 'wp-admin/includes/nav-menu.php';
     self::factory()->post->create_many(3, array('post_type' => 'page', 'post_content' => 'foo'));
     self::factory()->post->create(array('post_type' => 'page', 'post_content' => 'bar'));
     $request = array('type' => 'quick-search-posttype-page', 'q' => 'foo', 'response-format' => 'json');
     $output = get_echo('_wp_ajax_menu_quick_search', array($request));
     $this->assertNotEmpty($output);
     $results = explode("\n", trim($output));
     $this->assertCount(3, $results);
 }
开发者ID:ryelle,项目名称:WordPress,代码行数:14,代码来源:wpAjaxMenuQuickSearch.php

示例9: test_add_oembed_discovery_links_to_attachment

 function test_add_oembed_discovery_links_to_attachment()
 {
     $post_id = self::factory()->post->create();
     $file = DIR_TESTDATA . '/images/canola.jpg';
     $attachment_id = self::factory()->attachment->create_object($file, $post_id, array('post_mime_type' => 'image/jpeg'));
     $this->go_to(get_permalink($attachment_id));
     $this->assertQueryTrue('is_attachment', 'is_singular', 'is_single');
     $expected = '<link rel="alternate" type="application/json+oembed" href="' . esc_url(get_oembed_endpoint_url(get_permalink())) . '" />' . "\n";
     $expected .= '<link rel="alternate" type="text/xml+oembed" href="' . esc_url(get_oembed_endpoint_url(get_permalink(), 'xml')) . '" />' . "\n";
     $this->assertEquals($expected, get_echo('wp_oembed_add_discovery_links'));
 }
开发者ID:boonebgorges,项目名称:develop.wordpress,代码行数:11,代码来源:discovery.php

示例10: array

 /**
  * @ticket 32312
  */
 public function test_submit_button_and_submit_field_should_fall_back_on_defaults_when_filtered_defaults_do_not_contain_the_keys()
 {
     $p = self::factory()->post->create();
     $args = array('name_submit' => 'foo-name', 'id_submit' => 'foo-id', 'class_submit' => 'foo-class', 'label_submit' => 'foo-label');
     add_filter('comment_form_defaults', array($this, 'filter_comment_form_defaults'));
     $form = get_echo('comment_form', array($args, $p));
     remove_filter('comment_form_defaults', array($this, 'filter_comment_form_defaults'));
     $button = '<input name="foo-name" type="submit" id="foo-id" class="foo-class" value="foo-label" />';
     $hidden = get_comment_id_fields($p);
     $this->assertRegExp('|<p class="form\\-submit">\\s*' . $button . '\\s*' . $hidden . '\\s*|', $form);
 }
开发者ID:boonebgorges,项目名称:develop.wordpress,代码行数:14,代码来源:commentForm.php

示例11: testDatetimeTimestampFieldAssets

 function testDatetimeTimestampFieldAssets()
 {
     $field = new CMB_Datetime_Timestamp_Field('foo', 'Title', array());
     // Register CMB-Scripts as this is a dependency.
     wp_enqueue_script('cmb-scripts', trailingslashit(CMB_URL) . 'js/cmb.js', array('jquery'));
     $field->enqueue_scripts();
     $scripts_output = get_echo('wp_print_scripts');
     // Scripts
     $this->assertContains(CMB_URL . '/js/cmb.js', $scripts_output);
     $this->assertContains(CMB_URL . '/js/jquery.timePicker.min.js', $scripts_output);
     $this->assertContains(CMB_URL . '/js/field.datetime.js', $scripts_output);
 }
开发者ID:duncanjbrown,项目名称:Custom-Meta-Boxes,代码行数:12,代码来源:testDateField.php

示例12: test_filtered_emoji_png_cdn

 /**
  * @ticket 36525
  */
 public function test_filtered_emoji_png_cdn()
 {
     $png_cdn = 'https://s.w.org/images/core/emoji/2.2.1/72x72/';
     $svn_cdn = 'https://s.w.org/images/core/emoji/2.2.1/svg/';
     $filtered_png_cdn = $this->_filtered_emoji_png_cdn();
     add_filter('emoji_url', array($this, '_filtered_emoji_png_cdn'));
     $output = get_echo('_print_emoji_detection_script');
     $this->assertContains(wp_json_encode($filtered_png_cdn), $output);
     $this->assertNotContains(wp_json_encode($png_cdn), $output);
     $this->assertContains(wp_json_encode($svn_cdn), $output);
     remove_filter('emoji_url', array($this, '_filtered_emoji_png_cdn'));
 }
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:15,代码来源:Emoji.php

示例13: test_search_returns_results_for_published_posts

 /**
  * Test that search only returns results for published posts.
  *
  * @ticket 33742
  */
 public function test_search_returns_results_for_published_posts()
 {
     require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
     // This will make sure that WP_Query sets is_admin to true.
     set_current_screen('nav-menu.php');
     self::factory()->post->create(array('post_type' => 'post', 'post_status' => 'publish', 'post_title' => 'Publish', 'post_content' => 'FOO'));
     self::factory()->post->create(array('post_type' => 'post', 'post_status' => 'draft', 'post_title' => 'Draft', 'post_content' => 'FOO'));
     self::factory()->post->create(array('post_type' => 'post', 'post_status' => 'pending', 'post_title' => 'Pending', 'post_content' => 'FOO'));
     self::factory()->post->create(array('post_type' => 'post', 'post_status' => 'future', 'post_title' => 'Future', 'post_content' => 'FOO', 'post_date' => gmdate('Y-m-d H:i:s', strtotime('+1 month'))));
     $request = array('type' => 'quick-search-posttype-post', 'q' => 'FOO');
     $output = get_echo('_wp_ajax_menu_quick_search', array($request));
     $this->assertNotEmpty($output);
     $results = explode("\n", trim($output));
     $this->assertCount(1, $results);
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:20,代码来源:wpAjaxMenuQuickSearch.php

示例14: test_custom_submit_field

	public function test_custom_submit_field() {
		$p = $this->factory->post->create();

		$args = array(
			'name_submit' => 'foo-name',
			'id_submit' => 'foo-id',
			'class_submit' => 'foo-class',
			'label_submit' => 'foo-label',
			'submit_field' => '<p class="my-custom-submit-field">%1$s %2$s</p>'
		);
		$form = get_echo( 'comment_form', array( $args, $p ) );

		$button = '<input name="foo-name" type="submit" id="foo-id" class="foo-class" value="foo-label" />';
		$hidden = get_comment_id_fields( $p );
		$this->assertRegExp( '|<p class="my\-custom\-submit\-field">\s*' . $button . '\s*' . $hidden . '\s*|', $form );
	}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:16,代码来源:commentForm.php

示例15: test_rest_pre_serve_request_headers

 function test_rest_pre_serve_request_headers()
 {
     if (!function_exists('xdebug_get_headers')) {
         $this->markTestSkipped('xdebug is required for this test');
     }
     $post = $this->factory()->post->create_and_get(array('post_title' => 'Hello World'));
     $request = new WP_REST_Request('GET', '/oembed/1.0/embed');
     $request->set_param('url', get_permalink($post->ID));
     $request->set_param('format', 'xml');
     $server = new WP_REST_Server();
     $response = $server->dispatch($request);
     $output = get_echo('_oembed_rest_pre_serve_request', array(true, $response, $request, $server));
     $this->assertNotEmpty($output);
     $headers = xdebug_get_headers();
     $this->assertTrue(in_array('Content-Type: text/xml; charset=' . get_option('blog_charset'), $headers));
 }
开发者ID:boonebgorges,项目名称:develop.wordpress,代码行数:16,代码来源:headers.php


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