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


PHP SimplePie::get_language方法代码示例

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


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

示例1: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     /** @var PageModel $objPage */
     global $objPage;
     if ($this->rss_template != 'rss_default') {
         $this->strTemplate = $this->rss_template;
         /** @var FrontendTemplate|object $objTemplate */
         $objTemplate = new \FrontendTemplate($this->strTemplate);
         $this->Template = $objTemplate;
         $this->Template->setData($this->arrData);
     }
     $this->Template->link = $this->objFeed->get_link();
     $this->Template->title = $this->objFeed->get_title();
     $this->Template->language = $this->objFeed->get_language();
     $this->Template->description = $this->objFeed->get_description();
     $this->Template->copyright = $this->objFeed->get_copyright();
     // Add image
     if ($this->objFeed->get_image_url()) {
         $this->Template->image = true;
         $this->Template->src = $this->objFeed->get_image_url();
         $this->Template->alt = $this->objFeed->get_image_title();
         $this->Template->href = $this->objFeed->get_image_link();
         $this->Template->height = $this->objFeed->get_image_height();
         $this->Template->width = $this->objFeed->get_image_width();
     }
     // Get the items (see #6107)
     $arrItems = array_slice($this->objFeed->get_items(0, intval($this->numberOfItems) + intval($this->skipFirst)), intval($this->skipFirst), intval($this->numberOfItems) ?: null);
     $limit = count($arrItems);
     $offset = 0;
     // Split pages
     if ($this->perPage > 0) {
         // Get the current page
         $id = 'page_r' . $this->id;
         $page = \Input::get($id) !== null ? \Input::get($id) : 1;
         // Do not index or cache the page if the page number is outside the range
         if ($page < 1 || $page > max(ceil(count($arrItems) / $this->perPage), 1)) {
             throw new PageNotFoundException('Page not found: ' . \Environment::get('uri'));
         }
         // Set limit and offset
         $offset = ($page - 1) * $this->perPage;
         $limit = $this->perPage + $offset;
         $objPagination = new \Pagination(count($arrItems), $this->perPage, \Config::get('maxPaginationLinks'), $id);
         $this->Template->pagination = $objPagination->generate("\n  ");
     }
     $items = array();
     $last = min($limit, count($arrItems)) - 1;
     /** @var \SimplePie_Item[] $arrItems */
     for ($i = $offset, $c = count($arrItems); $i < $limit && $i < $c; $i++) {
         $items[$i] = array('link' => $arrItems[$i]->get_link(), 'title' => $arrItems[$i]->get_title(), 'permalink' => $arrItems[$i]->get_permalink(), 'description' => str_replace(array('<?', '?>'), array('&lt;?', '?&gt;'), $arrItems[$i]->get_description()), 'class' => ($i == 0 ? ' first' : '') . ($i == $last ? ' last' : '') . ($i % 2 == 0 ? ' even' : ' odd'), 'pubdate' => \Date::parse($objPage->datimFormat, $arrItems[$i]->get_date('U')), 'category' => $arrItems[$i]->get_category(0), 'object' => $arrItems[$i]);
         // Add author
         if (($objAuthor = $arrItems[$i]->get_author(0)) != false) {
             $items[$i]['author'] = trim($objAuthor->name . ' ' . $objAuthor->email);
         }
         // Add enclosure
         if (($objEnclosure = $arrItems[$i]->get_enclosure(0)) != false) {
             $items[$i]['enclosure'] = $objEnclosure->get_link();
         }
     }
     $this->Template->items = array_values($items);
 }
开发者ID:contao,项目名称:core-bundle,代码行数:63,代码来源:ModuleRssReader.php

示例2: add

 /**
  */
 public function add()
 {
     $feed_user_title = $this->input->post('feed_title', TRUE);
     $feed_url = $this->input->post('feed_url');
     $usercat = $this->input->post('category');
     $feed_filter_type = $this->input->post('feed_type');
     $_icon = $this->input->post('favicon_icon');
     $favicon_icon = $_icon;
     if (!isset($feed_url) || $feed_url == '') {
         $this->stencil->title('Feeds');
         $this->stencil->layout('admin_layout');
         $this->stencil->css(array('admin_css/bootstrap.min', 'admin_css/bootstrap-responsive.min', 'admin_css/styles'));
         $this->stencil->js(array('vendors/datatables/js/jquery.dataTables.min.js', 'DT_bootstrap'));
         $this->stencil->paint('admin/feeds/add');
     } else {
         $check = $this->validateUrl($feed_url);
         if ($check == FALSE) {
             echo json_encode(array('result' => 'fail', 'msg' => '<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">×</button>Url Already exists in the database!</div>'));
             die;
         }
         $feed = new SimplePie();
         $feed->set_feed_url($feed_url);
         $feed->set_cache_location(APPPATH . '/cache');
         $feed->set_output_encoding('ISO-8859-1');
         $feed->init();
         $feed->handle_content_type();
         // Language
         $lang = $feed->get_language();
         $language = isset($lang) ? $lang : 'en-us';
         if ($feed->get_type() & SIMPLEPIE_TYPE_NONE) {
             $feed_type = 'Unknown';
         } elseif ($feed->get_type() & SIMPLEPIE_TYPE_RSS_ALL) {
             $feed_type = 'RSS';
         } elseif ($feed->get_type() & SIMPLEPIE_TYPE_ATOM_ALL) {
             $feed_type = 'Atom';
         } elseif ($feed->get_type() & SIMPLEPIE_TYPE_ALL) {
             $feed_type = 'Supported';
         }
         // Author
         if ($author = $feed->get_author()) {
             $feedAuthor = $author->get_name();
         } else {
             $feedAuthor = '';
         }
         if ($feed->error()) {
             echo json_encode(array('result' => 'fail', 'msg' => '<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">×</button>Found error while making request</div>'));
         } else {
             //                $return = $this->feed_model->addFeeds($feed->get_items(0, 500));
             $feed_image_link = $feed->get_image_link();
             $feed_image_url = $feed->get_image_url();
             $feed_image_title = $feed->get_image_title();
             $return = $this->feedModel->addFeeds($feed->get_items(0, 500), $feed_image_link, $feed_image_url, $feed_image_title, $usercat, $feed_url, $language, $feed_type, $feedAuthor, $feed_filter_type, $feed_user_title, $favicon_icon);
             if ($return) {
                 echo json_encode(array('result' => 'success', 'msg' => '<div class="alert alert-success"><button type="button" class="close" data-dismiss="alert">×</button>Blog is added successfully</div>'));
             } else {
                 echo json_encode(array('result' => 'fail', 'msg' => '<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">×</button>Found error while making request</div>'));
             }
         }
     }
 }
开发者ID:robdmat,项目名称:sport.net,代码行数:62,代码来源:feeds.php

示例3: data

 /**
  * Handles all of the heavy lifting for getting the feed, parsing it, and managing customizations.
  *
  * @access private
  * @param mixed $url Either a single feed URL (as a string) or an array of feed URLs (as an array of strings).
  * @param array $options An associative array of options that the function should take into account when rendering the markup.
  * <ul>
  *     <li>string $classname  - The classname that the <div> surrounding the feed should have. Defaults to nb-list for newsblocks::listing() and nb-wide for newsblocks::wide().</li>
  *     <li>string $copyright - The copyright string to use for a feed. Not part of the standard output, but it's available if you want to use it. Defaults to NULL with multifeeds; Use $item->get_feed()->get_copyright() instead.</li>
  *     <li>string $date_format - The format to use when displaying dates on items. Uses values from http://php.net/strftime, NOT http://php.net/date.</li>
  *     <li>string $description - The description for the feed (not the item). Not part of the standard output, but it's available if you want to use it. Defaults to NULL with multifeeds; Use $item->get_feed()->get_description() instead.</li>
  *     <li>string $direction - The direction of the text. Valid values are "ltr" and "rtl". Defaults to "ltr".</li>
  *     <li>string $favicon - The favicon URL to use for the feed. Since favicon URLs aren't actually located in feeds, SimplePie guesses. Sometimes that guess is wrong. Give it the correct favicon with this option. Defaults to NULL with multifeeds; Use $item->get_feed()->get_favicon() instead.</li>
  *     <li>string $id - The ID attribute that the <div> surrounding the feed should have. This value should be unique per feed. Defaults to a SHA1 hash value based on the URL(s).</li>
  *     <li>string $item_classname - The classname for the items. Useful for styling with CSS. Also useful for JavaScript in creating custom tooltips for a feed. Defaults to "tips".</li>
  *     <li>integer $items - The number of items to show (the rest are hidden until "More" is clicked). Defaults to 10.</li>
  *     <li>string $language - The language of the feed. Not part of the standard output, but it's available if you want to use it. Defaults to NULL with multifeeds; Use $item->get_feed()->get_language() instead.</li>
  *     <li>integer $length - The maximum character length of the item description in the tooltip. Defaults to 200.</li>
  *     <li>string $more - The text to use for the "More" link. Defaults to "More &raquo;"</li>
  *     <li>boolean $more_move - Whether the "More" link should move when it's clicked. Defaults to FALSE (i.e. stays in the same place).</li>
  *     <li>boolean $more_fx - Whether the secondary list should slide or simply appear/disappear when the "More" link is clicked. Defaults to TRUE (i.e. slides).</li>
  *     <li>string $permalink - The permalink for the feed (not the item). Defaults to NULL with multifeeds; Use $item->get_feed()->get_permalink() instead.</li>
  *     <li>boolean $show_title - Whether to show the title of the feed. Defaults to TRUE.</li>
  *     <li>integer $since - A Unix timestamp. Anything posted more recently than this timestamp will get the "New" image applied to it. Defaults to 24 hours ago.</li>
  *     <li>$string $title - The title for the feed (not the item). Defaults to multiple titles with multifeeds, so you should manually set it in that case.</li>
  * </ul>
  * @return string The (X)HTML markup to display on the page.
  */
 function data($url, $options = null)
 {
     // Create a new SimplePie instance with this feed
     $feed = new SimplePie();
     $feed->set_feed_url($url);
     $feed->init();
     // Prep URL values to hash later.
     if (!is_array($url)) {
         $hash_str = array($url);
     } else {
         $hash_str = $url;
     }
     // Set the default values.
     $classname = null;
     $copyright = $feed->get_copyright();
     $date_format = '%a, %e %b %Y, %I:%M %p';
     $description = $feed->get_description();
     $direction = 'ltr';
     $favicon = $feed->get_favicon();
     $id = 'a' . sha1(implode('', $hash_str));
     $item_classname = 'tips';
     $items = 10;
     $language = $feed->get_language();
     $length = 200;
     $more = 'More &raquo;';
     $more_move = false;
     $more_fx = true;
     $permalink = $feed->get_permalink();
     $show_title = true;
     $since = time() - 24 * 60 * 60;
     // 24 hours ago.
     $title = $feed->get_title();
     // Override defaults with passed-in values.
     extract($options);
     // Set values for those that are still null
     if (!$favicon) {
         $favicon = NB_FAVICON_DEFAULT;
     }
     if (!$title) {
         if (is_array($url)) {
             $feed_title = array();
             foreach ($url as $u) {
                 $feed_title[] = newsblocks::name($u);
             }
             $title = implode(', ', $feed_title);
         }
     }
     // Send the data back to the calling function.
     return array('classname' => $classname, 'copyright' => $copyright, 'date_format' => $date_format, 'description' => $description, 'direction' => $direction, 'favicon' => $favicon, 'feed' => $feed, 'id' => $id, 'item_classname' => $item_classname, 'items' => $items, 'language' => $language, 'length' => $length, 'more' => $more, 'more_move' => $more_move, 'more_fx' => $more_fx, 'permalink' => $permalink, 'show_title' => $show_title, 'since' => $since, 'title' => $title);
 }
开发者ID:postprefix,项目名称:newsblocks,代码行数:78,代码来源:newsblocks.inc.php

示例4: setCron

 public function setCron()
 {
     $getUnique = $this->getAllFeedUrls();
     if (!empty($getUnique)) {
         foreach ($getUnique as $feedTableData) {
             $feed_user_title = $feedTableData->feed_user_title;
             $feed_url = $feedTableData->feed_admin_url;
             $usercat = $feedTableData->feed_user_category;
             $feed_filter_type = $feedTableData->feed_filter_type;
             $favicon_icon = $feedTableData->feed_favicon;
             $feed = new SimplePie();
             $feed->set_feed_url($feed_url);
             $feed->set_cache_location(APPPATH . '/cache');
             $feed->set_output_encoding('ISO-8859-1');
             $feed->init();
             $feed->handle_content_type();
             // Language
             $lang = $feed->get_language();
             $language = isset($lang) ? $lang : 'en-us';
             if ($feed->get_type() & SIMPLEPIE_TYPE_NONE) {
                 $feed_type = 'Unknown';
             } elseif ($feed->get_type() & SIMPLEPIE_TYPE_RSS_ALL) {
                 $feed_type = 'RSS';
             } elseif ($feed->get_type() & SIMPLEPIE_TYPE_ATOM_ALL) {
                 $feed_type = 'Atom';
             } elseif ($feed->get_type() & SIMPLEPIE_TYPE_ALL) {
                 $feed_type = 'Supported';
             }
             // Author
             if ($author = $feed->get_author()) {
                 $feedAuthor = $author->get_name();
             } else {
                 $feedAuthor = '';
             }
             if ($feed->error()) {
                 die;
             } else {
                 $feed_image_link = $feed->get_image_link();
                 $feed_image_url = $feed->get_image_url();
                 $feed_image_title = $feed->get_image_title();
                 $this->addFeeds($feed->get_items(0, 500), $feed_image_link, $feed_image_url, $feed_image_title, $usercat, $feed_url, $language, $feed_type, $feedAuthor, $feed_filter_type, $feed_user_title, $favicon_icon);
             }
         }
     }
 }
开发者ID:robdmat,项目名称:sport.net,代码行数:45,代码来源:cron_model.php

示例5: SimplePieWP


//.........这里部分代码省略.........
        $tmpl = str_replace('{FEED_FAVICON}', '', $tmpl);
    }
    // FEED_IMAGE_HEIGHT
    if ($image_height = $feed->get_image_height()) {
        $tmpl = str_replace('{FEED_IMAGE_HEIGHT}', SimplePie_WordPress::post_process('FEED_IMAGE_HEIGHT', $image_height), $tmpl);
    } else {
        $tmpl = str_replace('{FEED_IMAGE_HEIGHT}', '', $tmpl);
    }
    // FEED_IMAGE_LINK
    if ($image_link = $feed->get_image_link()) {
        $tmpl = str_replace('{FEED_IMAGE_LINK}', SimplePie_WordPress::post_process('FEED_IMAGE_LINK', $image_link), $tmpl);
    } else {
        $tmpl = str_replace('{FEED_IMAGE_LINK}', '', $tmpl);
    }
    // FEED_IMAGE_TITLE
    if ($image_title = $feed->get_image_title()) {
        $tmpl = str_replace('{FEED_IMAGE_TITLE}', SimplePie_WordPress::post_process('FEED_IMAGE_TITLE', $image_title), $tmpl);
    } else {
        $tmpl = str_replace('{FEED_IMAGE_TITLE}', '', $tmpl);
    }
    // FEED_IMAGE_URL
    if ($image_url = $feed->get_image_url()) {
        $tmpl = str_replace('{FEED_IMAGE_URL}', SimplePie_WordPress::post_process('FEED_IMAGE_URL', $image_url), $tmpl);
    } else {
        $tmpl = str_replace('{FEED_IMAGE_URL}', '', $tmpl);
    }
    // FEED_IMAGE_WIDTH
    if ($image_width = $feed->get_image_width()) {
        $tmpl = str_replace('{FEED_IMAGE_WIDTH}', SimplePie_WordPress::post_process('FEED_IMAGE_WIDTH', $image_width), $tmpl);
    } else {
        $tmpl = str_replace('{FEED_IMAGE_WIDTH}', '', $tmpl);
    }
    // FEED_LANGUAGE
    if ($language = $feed->get_language()) {
        $tmpl = str_replace('{FEED_LANGUAGE}', SimplePie_WordPress::post_process('FEED_LANGUAGE', $language), $tmpl);
    } else {
        $tmpl = str_replace('{FEED_LANGUAGE}', '', $tmpl);
    }
    // FEED_LATITUDE
    if ($latitude = $feed->get_latitude()) {
        $tmpl = str_replace('{FEED_LATITUDE}', SimplePie_WordPress::post_process('FEED_LATITUDE', $latitude), $tmpl);
    } else {
        $tmpl = str_replace('{FEED_LATITUDE}', '', $tmpl);
    }
    // FEED_LONGITUDE
    if ($longitude = $feed->get_longitude()) {
        $tmpl = str_replace('{FEED_LONGITUDE}', SimplePie_WordPress::post_process('FEED_LONGITUDE', $longitude), $tmpl);
    } else {
        $tmpl = str_replace('{FEED_LONGITUDE}', '', $tmpl);
    }
    // FEED_PERMALINK
    if ($permalink = $feed->get_permalink()) {
        $tmpl = str_replace('{FEED_PERMALINK}', SimplePie_WordPress::post_process('FEED_PERMALINK', $permalink), $tmpl);
    } else {
        $tmpl = str_replace('{FEED_PERMALINK}', '', $tmpl);
    }
    // FEED_TITLE
    if ($title = $feed->get_title()) {
        $tmpl = str_replace('{FEED_TITLE}', SimplePie_WordPress::post_process('FEED_TITLE', $title), $tmpl);
    } else {
        $tmpl = str_replace('{FEED_TITLE}', '', $tmpl);
    }
    // SUBSCRIBE_URL
    if ($subscribe_url = $feed->subscribe_url()) {
        $tmpl = str_replace('{SUBSCRIBE_URL}', SimplePie_WordPress::post_process('SUBSCRIBE_URL', $subscribe_url), $tmpl);
    } else {
开发者ID:simplepie,项目名称:wordpress,代码行数:67,代码来源:simplepie_wordpress_2.php

示例6: _setSimplePieModxPlaceholders


//.........这里部分代码省略.........
            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();
                $phArray[$joinKey]['longitude'] = $feed->get_longitude();

                $phArray[$joinKey]['language'] = $feed->get_language();
                $phArray[$joinKey]['encoding'] = $feed->get_encoding();

                if ($item->get_authors()) {
                    foreach ($item->get_authors() as $authorObject) {
                        $authorName = $authorObject->get_name();
                        $authorLink = $authorObject->get_link();
                        $authorEmail = $authorObject->get_email();
                    }
                    $phArray[$joinKey]['authorName'] = $authorName;
                    $phArray[$joinKey]['authorLink'] = $authorLink;
                    $phArray[$joinKey]['authorEmail'] = $authorEmail;
                }

                $category = $item->get_category();
                if ($category) {
                    $phArray[$joinKey]['category'] = htmlspecialchars_decode($category->get_label(), ENT_QUOTES);
                }

                $contributor = $item->get_contributor();
                $phArray[$joinKey]['contributor'] = '';
                if ($contributor) {
                    $phArray[$joinKey]['contributor'] = $contributor->get_name();
                }

                if ($feed->get_type() & SIMPLEPIE_TYPE_NONE) {
                    $phArray[$joinKey]['getType'] = 'Unknown';
                } elseif ($feed->get_type() & SIMPLEPIE_TYPE_RSS_ALL) {
                    $phArray[$joinKey]['getType'] = 'RSS';
                } elseif ($feed->get_type() & SIMPLEPIE_TYPE_ATOM_ALL) {
                    $phArray[$joinKey]['getType'] = 'Atom';
                } elseif ($feed->get_type() & SIMPLEPIE_TYPE_ALL) {
                    $phArray[$joinKey]['getType'] = 'Supported';
                }
				
				// Media from Flickr RSS stream
				if ($enclosure = $item->get_enclosure()) {
						$phArray[$joinKey]['itemImageThumbnailUrl'] = $enclosure->get_thumbnail();
						$phArray[$joinKey]['itemImageWidth'] = $enclosure->get_width();
						$phArray[$joinKey]['itemImageHeight'] = $enclosure->get_height();
				}
				

                $countLimit++;
                $joinKey++;
            } // foreach ($feed->get_items($getItemStart, $getItemEnd) as $item)
        } // foreach ($spie['setFeedUrl'] as $setFeedUrl)
        return $this->_filterModxTags($phArray);
    }
开发者ID:ncrossland,项目名称:spiefeed,代码行数:101,代码来源:spiefeed.class.php


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