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


PHP is_success函数代码示例

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


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

示例1: filter

   the "comments.php" file within the "Comments Loop" with the following line.
   <br/>
      if(function_exists(ckrating_display_karma)) { ckrating_display_karma(); }
   </p>
   <p>
   <b>Styling the Comment Box:</b>
   The comment styling uses the new
   comment_class filter (introduced in Wordpress 2.7). If your
   theme doesn't use Wordpress 2.7 wp_list_comments(),
   you'll only see the comment text background being styled/highlighted. To
   fix the problem, you need to add comment_class into your existing
   theme. For example code, please see <a
   href="http://brassblogs.com/blog/wordpress-27-and-comment-display">here</a>.
   </p>

<h2>News</h2> <ul style="list-style-type:disc;margin-left: 15px; margin-right:20px;">
<?php 
require_once ABSPATH . WPINC . '/rss.php';
$resp = _fetch_remote_file('http://WealthyNetizen.com/feed/');
if (is_success($resp->status)) {
    $rss = _response_to_rss($resp);
    $blog_posts = array_slice($rss->items, 0, 3);
    $posts_arr = array();
    foreach ($blog_posts as $item) {
        echo '<li><a href="' . $item['link'] . '">' . $item['title'] . '</a><br>' . $item['description'] . '</li>';
    }
}
print '</ul>';
?>
</div>
开发者ID:gigikiri,项目名称:bcnAutoWallpaperSite,代码行数:30,代码来源:comment-rating-options.php

示例2: fetch_rss

 /**
  * Build Magpie object based on RSS from URL.
  *
  * @since 1.5.0
  * @package External
  * @subpackage MagpieRSS
  *
  * @param string $url URL to retrieve feed
  * @return bool|MagpieRSS false on failure or MagpieRSS object on success.
  */
 function fetch_rss($url)
 {
     // initialize constants
     init();
     if (!isset($url)) {
         // error("fetch_rss called without a url");
         return false;
     }
     // if cache is disabled
     if (!MAGPIE_CACHE_ON) {
         // fetch file, and parse it
         $resp = _fetch_remote_file($url);
         if (is_success($resp->status)) {
             return _response_to_rss($resp);
         } else {
             // error("Failed to fetch $url and cache is off");
             return false;
         }
     } else {
         // Flow
         // 1. check cache
         // 2. if there is a hit, make sure its fresh
         // 3. if cached obj fails freshness check, fetch remote
         // 4. if remote fails, return stale object, or error
         $cache = new RSSCache(MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE);
         if (MAGPIE_DEBUG and $cache->ERROR) {
             debug($cache->ERROR, E_USER_WARNING);
         }
         $cache_status = 0;
         // response of check_cache
         $request_headers = array();
         // HTTP headers to send with fetch
         $rss = 0;
         // parsed RSS object
         $errormsg = 0;
         // errors, if any
         if (!$cache->ERROR) {
             // return cache HIT, MISS, or STALE
             $cache_status = $cache->check_cache($url);
         }
         // if object cached, and cache is fresh, return cached obj
         if ($cache_status == 'HIT') {
             $rss = $cache->get($url);
             if (isset($rss) and $rss) {
                 $rss->from_cache = 1;
                 if (MAGPIE_DEBUG > 1) {
                     debug("MagpieRSS: Cache HIT", E_USER_NOTICE);
                 }
                 return $rss;
             }
         }
         // else attempt a conditional get
         // set up headers
         if ($cache_status == 'STALE') {
             $rss = $cache->get($url);
             if (isset($rss->etag) and $rss->last_modified) {
                 $request_headers['If-None-Match'] = $rss->etag;
                 $request_headers['If-Last-Modified'] = $rss->last_modified;
             }
         }
         $resp = _fetch_remote_file($url, $request_headers);
         if (isset($resp) and $resp) {
             if ($resp->status == '304') {
                 // we have the most current copy
                 if (MAGPIE_DEBUG > 1) {
                     debug("Got 304 for {$url}");
                 }
                 // reset cache on 304 (at minutillo insistent prodding)
                 $cache->set($url, $rss);
                 return $rss;
             } elseif (is_success($resp->status)) {
                 $rss = _response_to_rss($resp);
                 if ($rss) {
                     if (MAGPIE_DEBUG > 1) {
                         debug("Fetch successful");
                     }
                     // add object to cache
                     $cache->set($url, $rss);
                     return $rss;
                 }
             } else {
                 $errormsg = "Failed to fetch {$url}. ";
                 if ($resp->error) {
                     # compensate for Snoopy's annoying habbit to tacking
                     # on '\n'
                     $http_error = substr($resp->error, 0, -2);
                     $errormsg .= "(HTTP Error: {$http_error})";
                 } else {
                     $errormsg .= "(HTTP Response: " . $resp->response_code . ')';
                 }
//.........这里部分代码省略.........
开发者ID:Esleelkartea,项目名称:herramienta_para_autodiagnostico_ADEADA,代码行数:101,代码来源:rss.php

示例3: noel_theme_display

function noel_theme_display()
{
    ?>
	<div class="wrap">
		<h2><?php 
    _e('Noel Theme Options', 'noel');
    ?>
</h2>
		<?php 
    settings_errors();
    ?>
		<form method="post" action="options.php">
			<?php 
    settings_fields('noel_theme_general_options');
    do_settings_sections('noel_theme_general_options');
    submit_button();
    ?>
		</form>

		<hr/>
		
		<style>
			.mimicpro-feed {
				list-style-type: disc;
				padding-left: 20px;
			}
			.mimicpro-donate {
				float: right;
				width: 250px;
				padding: 15px;
				margin: 0 0 15px 15px;
				border: 1px solid #e5e5e5;
				background-color: #e5e5e5;
				text-align: center;
			}
		</style>
		
		<div class="mimicpro-donate">
			<p>The author spends many hours working to create this theme.</p>
			<p>If you found this theme useful for you, please consider donating a little fortune for the author.</p>
			<p>Thank you.</p>
			<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
			<input type="hidden" name="cmd" value="_s-xclick">
			<input type="hidden" name="hosted_button_id" value="K6775WC99DFQ6">
			<input type="image" src="http://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
			<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
			</form>
		</div>
		
		<h3><?php 
    _e('News', 'noel');
    ?>
</h3>
		
		<ul class="mimicpro-feed">
		<?php 
    require_once ABSPATH . WPINC . '/rss.php';
    $resp = _fetch_remote_file('http://mimic-project.com/feed/');
    if (is_success($resp->status)) {
        $rss = _response_to_rss($resp);
        $blog_posts = array_slice($rss->items, 0, 4);
        $posts_arr = array();
        foreach ($blog_posts as $item) {
            echo '<li><a href="' . $item['link'] . '" style="font-size:120%;">' . $item['title'] . '</a><br>' . $item['description'] . '</li>';
        }
    }
    print '</ul>';
    ?>
		<div style="clear:both;"></div>
	</div>
<?php 
}
开发者ID:KasaiDot,项目名称:WP-Theme_Mime-DAL,代码行数:72,代码来源:functions.php


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