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


PHP SimplePie::force_fsockopen方法代码示例

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


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

示例1: _createSimplePie

 /**
  * _createSimplePie
  *
  * @param   string  &$feed  Params
  *
  * @return	object
  */
 private function _createSimplePie(&$feed)
 {
     include_once JPATH_AUTOTWEET . '/libs/SimplePie_autoloader.php';
     // Process the feed with SimplePie
     $simplePie = new SimplePie();
     $simplePie->set_feed_url($feed->xtform->get('url'));
     $simplePie->set_stupidly_fast(true);
     $simplePie->enable_order_by_date(true);
     if ($feed->xtform->get('encoding', 'utf-8')) {
         $simplePie->set_input_encoding($feed->xtform->get('encoding'));
     }
     if ($feed->xtform->get('force_fsockopen')) {
         $simplePie->force_fsockopen(true);
     }
     $use_sp_cache = EParameter::getComponentParam(CAUTOTWEETNG, 'use_sp_cache', true);
     if ($use_sp_cache && is_writable(JPATH_CACHE)) {
         $simplePie->set_cache_location(JPATH_CACHE);
         $simplePie->enable_cache(true);
     } else {
         $simplePie->enable_cache(false);
     }
     $set_sp_timeout = EParameter::getComponentParam(CAUTOTWEETNG, 'set_sp_timeout', 10);
     if ($set_sp_timeout) {
         $simplePie->set_timeout((int) $set_sp_timeout);
     }
     $simplePie->init();
     return $simplePie;
 }
开发者ID:johngrange,项目名称:wookeyholeweb,代码行数:35,代码来源:feedimporter.php

示例2: ikit_social_remote_fetch_eyeondesign_rss

/**
 * Refresh the eye on design cache
 */
function ikit_social_remote_fetch_eyeondesign_rss()
{
    $items = array();
    global $g_options;
    $feed = new SimplePie();
    $feed->set_cache_duration(0);
    $feed->set_timeout(5);
    $feed->set_feed_url(IKIT_SOCIAL_EYEONDESIGN_RSS_URL);
    $feed->set_cache_location(IKIT_DIR_CACHE);
    // XXX Fixes peculiar issue where feed was not pulling https://wcoaiga.atlassian.net/browse/AIGAIKIT-199
    $feed->force_feed(true);
    $feed->force_fsockopen(true);
    $feed->init();
}
开发者ID:aiga-chicago,项目名称:chicago.aiga.org,代码行数:17,代码来源:social.php

示例3: _setSimplePieModxPlaceholders

    /**
     * Processing the parameters into placeholders
     * @param string    $spie   snippet parameters
     * @return array    placeholders
     */
    private function _setSimplePieModxPlaceholders($spie) {
        /**
         * @link http://github.com/simplepie/simplepie/tree/one-dot-two
         */
        if (!file_exists($spie['simplePieClassFile'])) {
            return 'File ' . $spie['simplePieClassFile'] . ' does not exist.';
        }
        include_once $spie['simplePieClassFile'];
        $feed = new SimplePie();
        $joinKey = 0;
        foreach ($spie['setFeedUrl'] as $setFeedUrl) {
            $feed->set_cache_location($spie['setCacheLocation']);
            $feed->set_feed_url($setFeedUrl);

            if (isset($spie['setInputEncoding'])) {
                $feed->set_input_encoding($spie['setInputEncoding']);
            }
            if (isset($spie['setOutputEncoding'])) {
                $feed->set_output_encoding($spie['setOutputEncoding']);
            }
            // if no cURL, try fsockopen
            if (isset($spie['forceFSockopen'])) {
                $feed->force_fsockopen(true);
            }
            if (isset($spie['enableCache']))
                $feed->enable_cache($spie['enableCache']);
            if (isset($spie['enableOrderByDate']))
                $feed->enable_order_by_date($spie['enableOrderByDate']);
            if (isset($spie['setCacheDuration']))
                $feed->set_cache_duration($spie['setCacheDuration']);
            if (!empty($spie['setFaviconHandler']))
                $feed->set_favicon_handler($spie['setFaviconHandler'][0], $spie['setFaviconHandler'][1]);
            if (!empty($spie['setImageHandler'])) {
                // handler_image.php?image=67d5fa9a87bad230fb03ea68b9f71090
                $feed->set_image_handler($spie['setImageHandler'][0], $spie['setImageHandler'][1]);
            }

            // disabled since these are all splitted into a single fetching
            // it's  been used with different way, see below looping
//            if (isset($spie['setItemLimit']))
//                $feed->set_item_limit((int) $spie['setItemLimit']);

            if (isset($spie['setJavascript']))
                $feed->set_javascript($spie['setJavascript']);
            if (isset($spie['stripAttributes']))
                $feed->strip_attributes(array_merge($feed->strip_attributes, $spie['stripAttributes']));
            if (isset($spie['stripComments']))
                $feed->strip_comments($spie['stripComments']);
            if (isset($spie['stripHtmlTags']))
                $feed->strip_htmltags(array_merge($feed->strip_htmltags, $spie['stripHtmlTags']));

            /**
             * Initiating the Feeding.
             * This always be placed AFTER all the settings above.
             */
            if (!$feed->init()) {
                echo $feed->error();
                return FALSE;
            }

            $countItems = count($feed->get_items());
            if (1 > $countItems) {
                continue;
            }

            $feed->handle_content_type();

            $countLimit = 0;
            foreach ($feed->get_items($getItemStart, $getItemEnd) as $item) {

                if (isset($spie['setItemLimit']) && $spie['setItemLimit'] == $countLimit)
                    continue;

                $phArray[$joinKey]['favicon'] = $feed->get_favicon();
                $phArray[$joinKey]['link'] = $item->get_link();
                $phArray[$joinKey]['title'] = $item->get_title();
                $phArray[$joinKey]['description'] = $item->get_description();
                $phArray[$joinKey]['content'] = $item->get_content();

                $phArray[$joinKey]['permalink'] = $item->get_permalink();
                $parsedUrl = parse_url($phArray[$joinKey]['permalink']);
                $implodedParsedUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'];
                $imageLink = $feed->get_image_link() != '' ? $feed->get_image_link() : $implodedParsedUrl;
                $phArray[$joinKey]['imageLink'] = $imageLink;

                $phArray[$joinKey]['imageTitle'] = $feed->get_image_title();
                $phArray[$joinKey]['imageUrl'] = $feed->get_image_url();
                $phArray[$joinKey]['imageWidth'] = $feed->get_image_width();
                $phArray[$joinKey]['imageHeight'] = $feed->get_image_height();

                $phArray[$joinKey]['date'] = $item->get_date($spie['dateFormat']);
                $phArray[$joinKey]['localDate'] = $item->get_local_date($spie['localDateFormat']);
                $phArray[$joinKey]['copyright'] = $item->get_copyright();

                $phArray[$joinKey]['latitude'] = $feed->get_latitude();
//.........这里部分代码省略.........
开发者ID:ncrossland,项目名称:spiefeed,代码行数:101,代码来源:spiefeed.class.php


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