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


PHP feed::load方法代码示例

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


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

示例1: load

 /**
  * loads content for given source
  *
  * @return void
  * @param string $url
  */
 public function load($params)
 {
     $this->apiKey = $params['api'];
     if (strlen(trim($this->apiKey)) == 0) {
         $this->apiKey = \F3::get('readability');
     }
     parent::load(array('url' => $params['url']));
 }
开发者ID:ZMOM1031,项目名称:selfoss,代码行数:14,代码来源:readability.php

示例2: load

 /**
  * loads content for given source
  *
  * @return void
  * @param string $url
  */
 public function load($params)
 {
     parent::load(array('url' => $this->getXmlUrl()));
 }
开发者ID:gabor-udvari,项目名称:selfoss,代码行数:10,代码来源:teltarif.php

示例3: nvweb_metatags

function nvweb_metatags($vars = array())
{
    global $website;
    global $current;
    global $DB;
    global $structure;
    global $events;
    // process page title and (to do: get specific metatags)
    $section = '';
    $separator = ' | ';
    if (!empty($vars['title_separator'])) {
        $separator = $vars['title_separator'];
    }
    switch ($current['type']) {
        case 'item':
            $section = $DB->query_single('text', 'nv_webdictionary', ' node_type = ' . protect($current['type']) . ' AND
				    node_id = ' . protect($current['object']->id) . ' AND
					subtype = ' . protect('title') . ' AND
					website = ' . $website->id . ' AND
					   lang = ' . protect($current['lang']));
            $section = $separator . $section;
            break;
        case 'structure':
            $breadcrumbs = nvweb_breadcrumbs(array('separator' => $separator, 'links' => 'false'));
            $section = $separator . $breadcrumbs;
            break;
        default:
    }
    // global website metatags
    $metatags = $website->metatags;
    if (is_array($metatags)) {
        $metatags = $metatags[$current['lang']];
    }
    if (!empty($website->metatag_description[$current['lang']])) {
        $metatags .= "\n" . '<meta name="language" content="' . $current['lang'] . '" />' . "\n";
    }
    if (!empty($website->metatag_description[$current['lang']])) {
        $metatags .= "\n" . '<meta name="description" content="' . $website->metatag_description[$current['lang']] . '" />' . "\n";
    }
    // retrieve content tags and add it to the global metatags of the website
    $tags_website = str_replace(', ', ',', $website->metatag_keywords[$current['lang']]);
    $tags_website = explode(',', $tags_website);
    $tags_website = array_filter($tags_website);
    $tags_content = webdictionary::load_element_strings($current['type'], $current['object']->id);
    $tags_content = str_replace(', ', ',', @$tags_content[$current['lang']]['tags']);
    $tags_content = explode(',', $tags_content);
    $tags_content = array_filter($tags_content);
    $tags = array_merge($tags_website, $tags_content);
    $tags = implode(',', $tags);
    if (strpos($metatags, '<meta name="keywords" content="') !== FALSE) {
        $metatags = str_replace('<meta name="keywords" content="', '<meta name="keywords" content="' . $tags, $metatags);
    } else {
        $metatags .= '<meta name="keywords" content="' . $tags . '" />';
    }
    if (@$vars['generator'] != 'false') {
        $current_version = update::latest_installed();
        $metatags .= "\n" . '<meta name="generator" content="Navigate CMS ' . $current_version->version . '" />';
    }
    if ($website->favicon > 0) {
        $favicon = NAVIGATE_DOWNLOAD . '?wid=' . $website->id . '&id=' . $website->favicon . '&amp;disposition=inline';
        $metatags .= "\n" . '<link rel="shortcut icon" href="' . $favicon . '" />';
    }
    // website public feeds
    $DB->query('SELECT id FROM nv_feeds 
				 WHERE website = ' . $website->id . '
				   AND permission = 0
				   AND enabled = 1');
    $feeds = $DB->result('id');
    for ($f = 0; $f < count($feeds); $f++) {
        $feed = new feed();
        $feed->load($feeds[$f]);
        if (strpos(strtolower($feed->format), 'rss') !== false) {
            $mime = 'application/rss+xml';
        } else {
            if (strpos(strtolower($feed->format), 'atom') !== false) {
                $mime = 'application/atom+xml';
            } else {
                $mime = 'text/xml';
            }
        }
        $metatags .= "\n" . '<link rel="alternate" type="' . $mime . '" title="' . $feed->dictionary[$current['lang']]['title'] . '" href="' . $website->absolute_path() . $feed->paths[$current['lang']] . '" />';
    }
    $out = '<title>' . $website->name . $section . '</title>' . "\n";
    $out .= $metatags;
    if (!empty($website->additional_scripts) && empty($_SESSION['APP_USER#' . APP_UNIQUE])) {
        nvweb_after_body('html', $website->additional_scripts);
    }
    $events->trigger('metatags', 'render', array('out' => &$out, 'default_title' => $website->name . $section, 'section' => $section));
    return $out;
}
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:90,代码来源:metatags.php

示例4: generate_feed

 public static function generate_feed($id = NULL)
 {
     global $current;
     global $website;
     global $DB;
     if (empty($id)) {
         $id = $current['id'];
     }
     $item = new feed();
     $item->load($id);
     $permission = nvweb_object_enabled($item);
     if (!$permission) {
         return;
     }
     $feed = new UniversalFeedCreator();
     $feed->encoding = 'UTF-8';
     $feed->title = $item->dictionary[$current['lang']]['title'];
     $feed->description = $item->dictionary[$current['lang']]['description'];
     $feed->link = $website->absolute_path();
     $feed->syndicationURL = $website->absolute_path() . $item->paths[$current['lang']];
     if (!empty($item->image)) {
         $image = new FeedImage();
         $image->url = $website->absolute_path() . '/object?type=image&amp;id=' . $item->image;
         $image->link = $website->absolute_path();
         //$image->description = $vars['dictionary_description'];
         $feed->image = $image;
     }
     if (!empty($item->categories[0])) {
         $limit = intval($item->entries);
         if ($limit <= 0) {
             $limit = 10;
         }
         $DB->query(' SELECT SQL_CALC_FOUND_ROWS i.id, i.permission, i.date_published, i.date_unpublish,
                             i.date_to_display, COALESCE(NULLIF(i.date_to_display, 0), i.date_created) as pdate, d.text as title, i.position as position,
                             i.galleries as galleries, i.template as template
                       FROM nv_items i, nv_structure s, nv_webdictionary d
                      WHERE i.category IN(' . implode(",", $item->categories) . ')
                        AND i.website = ' . $website->id . '
                        AND i.permission = 0
                        AND (i.date_published = 0 OR i.date_published < ' . core_time() . ')
                        AND (i.date_unpublish = 0 OR i.date_unpublish > ' . core_time() . ')
                        AND s.id = i.category
                        AND (s.date_published = 0 OR s.date_published < ' . core_time() . ')
                        AND (s.date_unpublish = 0 OR s.date_unpublish > ' . core_time() . ')
                        AND s.permission = 0
                        AND (s.access = 0)
                        AND (i.access = 0)
                        AND d.website = i.website
                        AND d.node_type = "item"
                        AND d.subtype = "title"
                        AND d.node_id = i.id
                        AND d.lang = ' . protect($current['lang']) . '
                      ORDER BY pdate DESC
                      LIMIT ' . $limit . '
                     OFFSET 0');
         $rs = $DB->result();
         for ($x = 0; $x < count($rs); $x++) {
             if (nvweb_object_enabled($rs[$x])) {
                 $texts = webdictionary::load_element_strings('item', $rs[$x]->id);
                 $paths = path::loadElementPaths('item', $rs[$x]->id);
                 $fitem = new FeedItem();
                 $fitem->title = $texts[$current['lang']]['title'];
                 $fitem->link = $website->absolute_path() . $paths[$current['lang']];
                 switch ($item->content) {
                     case 'title':
                         // no description
                         break;
                     case 'content':
                         $fitem->description = $texts[$current['lang']]['section-main'];
                         break;
                     case 'summary':
                     default:
                         $fitem->description = $texts[$current['lang']]['section-main'];
                         $fitem->description = str_replace(array('</p>', '<br />', '<br/>', '<br>'), array('</p>' . "\n", '<br />' . "\n", '<br/>' . "\n", '<br>' . "\n"), $fitem->description);
                         $fitem->description = core_string_cut($fitem->description, 500, '&hellip;');
                         break;
                 }
                 $fitem->date = $rs[$x]->date_to_display;
                 // find an image to attach to the item
                 // A) first enabled image in item gallery
                 // B) first image on properties
                 $image = '';
                 if (!empty($rs[$x]->galleries)) {
                     $galleries = mb_unserialize($rs[$x]->galleries);
                     $photo = @array_shift(array_keys($galleries[0]));
                     if (!empty($photo)) {
                         $image = $website->absolute_path(false) . '/object?type=image&id=' . $photo;
                     }
                 }
                 if (empty($image)) {
                     // no image found on galleries, look for image properties
                     $properties = property::load_properties("item", $rs[$x]->template, "item", $rs[$x]->id);
                     for ($p = 0; $p < count($properties); $p++) {
                         if ($properties[$p]->type == 'image') {
                             if (!empty($properties[$p]->value)) {
                                 $image = $properties[$p]->value;
                             } else {
                                 if (!empty($properties[$p]->dvalue)) {
                                     $image = $properties[$p]->dvalue;
                                 }
//.........这里部分代码省略.........
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:101,代码来源:feed.class.php

示例5: run

function run()
{
    global $user;
    global $layout;
    global $DB;
    global $website;
    $out = '';
    $item = new feed();
    switch ($_REQUEST['act']) {
        case 1:
            // json data retrieval & operations
            switch ($_REQUEST['oper']) {
                case 'del':
                    // remove rows
                    $ids = $_REQUEST['ids'];
                    foreach ($ids as $id) {
                        $item->load($id);
                        $item->delete();
                    }
                    echo json_encode(true);
                    break;
                default:
                    // list or search
                    $page = intval($_REQUEST['page']);
                    $max = intval($_REQUEST['rows']);
                    $offset = ($page - 1) * $max;
                    $orderby = $_REQUEST['sidx'] . ' ' . $_REQUEST['sord'];
                    $where = " f.website = " . $website->id;
                    if ($_REQUEST['_search'] == 'true' || isset($_REQUEST['quicksearch'])) {
                        if (isset($_REQUEST['quicksearch'])) {
                            $where .= $item->quicksearch($_REQUEST['quicksearch']);
                        } else {
                            if (isset($_REQUEST['filters'])) {
                                $where .= navitable::jqgridsearch($_REQUEST['filters']);
                            } else {
                                // single search
                                $where .= ' AND ' . navitable::jqgridcompare($_REQUEST['searchField'], $_REQUEST['searchOper'], $_REQUEST['searchString']);
                            }
                        }
                    }
                    $sql = ' SELECT SQL_CALC_FOUND_ROWS f.*, d.text as title
							   FROM nv_feeds f
						  LEFT JOIN nv_webdictionary d
						  		 	 ON f.id = d.node_id
								 	AND d.node_type = "feed"
									AND d.subtype = "title"
									AND d.lang = "' . $website->languages_list[0] . '"
									AND d.website = ' . $website->id . '
							  WHERE ' . $where . '	
						   ORDER BY ' . $orderby . ' 
							  LIMIT ' . $max . '
							 OFFSET ' . $offset;
                    if (!$DB->query($sql, 'array')) {
                        throw new Exception($DB->get_last_error());
                    }
                    $dataset = $DB->result();
                    $total = $DB->foundRows();
                    $out = array();
                    $permissions = array(0 => '<img src="img/icons/silk/world.png" align="absmiddle" /> ' . t(69, 'Published'), 1 => '<img src="img/icons/silk/world_dawn.png" align="absmiddle" /> ' . t(70, 'Private'), 2 => '<img src="img/icons/silk/world_night.png" align="absmiddle" /> ' . t(81, 'Hidden'));
                    if (empty($dataset)) {
                        $rows = 0;
                    } else {
                        $rows = count($dataset);
                    }
                    for ($i = 0; $i < $rows; $i++) {
                        $out[$i] = array(0 => $dataset[$i]['id'], 1 => $dataset[$i]['title'], 2 => count(explode(',', $dataset[$i]['categories'])), 3 => $dataset[$i]['format'], 4 => $dataset[$i]['views'], 5 => $permissions[$dataset[$i]['permission']], 6 => $dataset[$i]['enabled'] == 1 ? '<img src="img/icons/silk/accept.png" />' : '<img src="img/icons/silk/cancel.png" />');
                    }
                    navitable::jqgridJson($out, $page, $offset, $max, $total);
                    break;
            }
            core_terminate();
            break;
        case 2:
            // edit/new form
            if (!empty($_REQUEST['id'])) {
                $item->load(intval($_REQUEST['id']));
            }
            if (isset($_REQUEST['form-sent'])) {
                $item->load_from_post();
                try {
                    $item->save();
                    $id = $item->id;
                    unset($item);
                    $item = new feed();
                    $item->load($id);
                    $layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
                } catch (Exception $e) {
                    $layout->navigate_notification($e->getMessage(), true, true);
                }
            }
            $out = feeds_form($item);
            break;
        case 4:
            // remove
            if (!empty($_REQUEST['id'])) {
                $item->load(intval($_REQUEST['id']));
                if ($item->delete() > 0) {
                    $layout->navigate_notification(t(55, 'Item removed successfully.'), false);
                    $out = feeds_list();
                } else {
//.........这里部分代码省略.........
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:101,代码来源:feeds.php

示例6: load

 /**
  * loads content for given source
  *
  * @return void
  * @param string $url
  */
 public function load($params)
 {
     parent::load(array('url' => $params['url']));
 }
开发者ID:sevengage,项目名称:feed-merge,代码行数:10,代码来源:instapaper.php


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