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


PHP Feed::parse方法代码示例

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


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

示例1: test_parse

 /**
  * Tests that Feed::parse gets the correct number of elements
  *
  * @test
  * @dataProvider provider_parse
  * @covers feed::parse
  * @param string  $source   URL to test
  * @param integer $expected Count of items
  */
 public function test_parse($source, $expected_titles)
 {
     $titles = array();
     foreach (Feed::parse($source) as $item) {
         $titles[] = $item['title'];
     }
     $this->assertSame($expected_titles, $titles);
 }
开发者ID:ortodesign,项目名称:cms,代码行数:17,代码来源:feedtest.php

示例2: before

 /**
  * Automatically executed before the widget action. Can be used to set
  * class properties, do authorization checks, and execute other custom code.
  *
  * @return  void
  */
 public function before()
 {
     //try to get the RSS from the cache
     $rss = Core::cache($this->rss_url, NULL, $this->rss_expire);
     //not cached :(
     if ($rss === NULL) {
         $rss = Feed::parse($this->rss_url, $this->rss_limit);
         Core::cache($this->rss_url, $rss, $this->rss_expire);
     }
     $this->rss_items = $rss;
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:17,代码来源:rss.php

示例3: fetch_data

 /**
  * 
  * @return array [$rss_url, $items]
  */
 public function fetch_data()
 {
     $cache = Cache::instance();
     $data = $cache->get($this->id);
     if (empty($data)) {
         $data = Feed::parse($this->rss_url, $this->limit);
         $cache->set($this->id, $data, Date::MINUTE * 10);
     }
     $data['rss_url'] = $this->rss_url;
     return $data;
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:15,代码来源:rss.php

示例4: action_index

 public function action_index()
 {
     //if not god redirect him to the normal profile page
     if (Auth::instance()->get_user()->id_role != Model_Role::ROLE_ADMIN) {
         HTTP::redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'index')));
     }
     Core::ocacu();
     $this->template->title = __('Welcome');
     Breadcrumbs::add(Breadcrumb::factory()->set_title($this->template->title));
     $rss_url = 'http://feeds.feedburner.com/RssBlogOpenEshop';
     $rss = Feed::parse($rss_url, 10);
     $this->template->content = View::factory('oc-panel/home', array('rss' => $rss));
 }
开发者ID:Ryanker,项目名称:open-eshop,代码行数:13,代码来源:home.php

示例5: action_static

	public function action_static()
	{
		$category = $this->request->param('category');
		$article = $this->request->param('article');
		
		try
		{
			// Load the article
			$view = new View("docs/{$this->lang}/$category/$article");
		}
		catch (Exception $e)
		{
			// Oh noes!
			$this->response->status(404);
			$view = new View('404');
		}

		$this->template->content = $view;

		if (($feed = Cache::instance()->get('feed')) === NULL)
		{
			// GitHub atom feed URL
			$url = 'https://github.com/goyote/docs/commits/master.atom';

			// Grab the 10 latest entries
			$entries = Feed::parse($url, 10);

			$feed = array();
			foreach ($entries as $entry)
			{
				$feed[] = array(
					'title' => $entry['title'],
					'href' => (string) $entry['link']['href'],
					'date' => Date::formatted_time($entry['updated'], 'n-d-Y'),
				);
			}

			// Cache the entries for 1 day
			Cache::instance()->set('feed', $feed, Date::DAY);
		}

		$this->template->set(array(
			'category' => ucwords(Inflector::humanize($category)),
			'article' => ucwords(Inflector::humanize($article)),
			'url' => array('category' => $category, 'article' => $article),
			'navigation' => $this->_config['navigation'],
			'resources' => Arr::path($this->_config, "resources.$category.$article"),
			'languages' => $this->_config['language']['supported'],
			'feed' => $feed,
		));
	}
开发者ID:nexeck,项目名称:docs,代码行数:51,代码来源:docs.php

示例6: _get_news_feed

 /**
  * Retrieve the news feed items. First try from cache, otherwise load it from the website.
  * @return array
  */
 private function _get_news_feed()
 {
     $benchmark = Profiler::start('Admin Dashboard', __FUNCTION__);
     $cache = Cache::instance();
     // Attempt to load feed from cache otherwise get it from the website.
     if (!($feed = $cache->get('admin.dashboard.news_feed', FALSE))) {
         try {
             $feed = Feed::parse($this->_news_feed_url);
             $cache->set('admin.dashboard.news_feed', $feed, 360);
         } catch (Exception $e) {
             Hint::error($e);
         }
     }
     Profiler::stop($benchmark);
     return $feed;
 }
开发者ID:modulargaming,项目名称:admin,代码行数:20,代码来源:Dashboard.php

示例7: action_index

 public function action_index()
 {
     //if not god redirect him to the normal profile page
     if (Auth::instance()->get_user()->id_role != Model_Role::ROLE_ADMIN) {
         Request::current()->redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'index')));
     }
     Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Welcome')));
     $this->template->title = 'Welcome';
     //try to get the RSS from the cache
     $rss_url = 'http://feeds.feedburner.com/OpenClassifieds';
     $rss = Core::cache($rss_url, NULL, 3 * 24 * 60 * 60);
     //not cached :(
     if ($rss === NULL) {
         $rss = Feed::parse($rss_url, 10);
         Core::cache($rss_url, $rss, 3 * 24 * 60 * 60);
     }
     $this->template->content = View::factory('oc-panel/home', array('rss' => $rss));
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:18,代码来源:home.php

示例8: action_index

 public function action_index()
 {
     //if not god redirect him to the normal profile page
     if (Auth::instance()->get_user()->id_role != Model_Role::ROLE_ADMIN) {
         HTTP::redirect(Route::url('oc-panel', array('controller' => 'myads', 'action' => 'index')));
     }
     Core::ocacu();
     $this->template->title = __('Welcome');
     Breadcrumbs::add(Breadcrumb::factory()->set_title($this->template->title));
     $this->template->bind('content', $content);
     $content = View::factory('oc-panel/home');
     /////////////////////RSS////////////////////////////////
     //try to get the RSS from the cache
     $rss_url = 'http://feeds.feedburner.com/OpenClassifieds';
     $content->rss = Feed::parse($rss_url, 10);
     /////////////////////ADS////////////////////////////////
     $content->res = new Model_Ad();
     //filter ads by status
     $content->res = $content->res->where('status', '=', Core::get('status', Model_Ad::STATUS_PUBLISHED));
     $content->res = $content->res->order_by('created', 'desc')->limit(10)->find_all();
     /////////////////////STATS////////////////////////////////
     //Getting the dates and range
     $from_date = Core::post('from_date', strtotime('-1 month'));
     $to_date = Core::post('to_date', time());
     //we assure is a proper time stamp if not we transform it
     if (is_string($from_date) === TRUE) {
         $from_date = strtotime($from_date);
     }
     if (is_string($to_date) === TRUE) {
         $to_date = strtotime($to_date);
     }
     //mysql formated dates
     $my_from_date = Date::unix2mysql($from_date);
     $my_to_date = Date::unix2mysql($to_date);
     //dates range we are filtering
     $dates = Date::range($from_date, $to_date, '+1 day', 'Y-m-d', array('date' => 0, 'count' => 0), 'date');
     //dates displayed in the form
     $content->from_date = date('Y-m-d', $from_date);
     $content->to_date = date('Y-m-d', $to_date);
     //ads published last XX days
     $query = DB::select(DB::expr('DATE(published) date'))->select(DB::expr('COUNT(id_ad) count'))->from('ads')->where('status', '=', Model_Ad::STATUS_PUBLISHED)->where('published', 'between', array($my_from_date, $my_to_date))->group_by(DB::expr('DATE( published )'))->order_by('date', 'asc')->execute();
     $ads_dates = $query->as_array('date');
     //Today
     $query = DB::select(DB::expr('COUNT(id_ad) count'))->from('ads')->where('status', '=', Model_Ad::STATUS_PUBLISHED)->where(DB::expr('DATE( created )'), '=', DB::expr('CURDATE()'))->group_by(DB::expr('DATE( published )'))->order_by('published', 'asc')->execute();
     $ads = $query->as_array();
     $content->ads_today = isset($ads[0]['count']) ? $ads[0]['count'] : 0;
     //Yesterday
     $query = DB::select(DB::expr('COUNT(id_ad) count'))->from('ads')->where('status', '=', Model_Ad::STATUS_PUBLISHED)->where(DB::expr('DATE( created )'), '=', date('Y-m-d', strtotime('-1 day')))->group_by(DB::expr('DATE( published )'))->order_by('published', 'asc')->execute();
     $ads = $query->as_array();
     $content->ads_yesterday = isset($ads[0]['count']) ? $ads[0]['count'] : 0;
     //Last 30 days ads
     $query = DB::select(DB::expr('COUNT(id_ad) count'))->from('ads')->where('status', '=', Model_Ad::STATUS_PUBLISHED)->where('published', 'between', array(date('Y-m-d', strtotime('-30 day')), date::unix2mysql()))->execute();
     $ads = $query->as_array();
     $content->ads_month = isset($ads[0]['count']) ? $ads[0]['count'] : 0;
     //total ads
     $query = DB::select(DB::expr('COUNT(id_ad) count'))->from('ads')->where('status', '=', Model_Ad::STATUS_PUBLISHED)->execute();
     $ads = $query->as_array();
     $content->ads_total = isset($ads[0]['count']) ? $ads[0]['count'] : 0;
     /////////////////////VISITS STATS////////////////////////////////
     //visits created last XX days
     $query = DB::select(DB::expr('DATE(created) date'))->select(DB::expr('COUNT(id_visit) count'))->from('visits')->where('created', 'between', array($my_from_date, $my_to_date))->group_by(DB::expr('DATE( created )'))->order_by('date', 'asc')->execute();
     $visits = $query->as_array('date');
     $stats_daily = array();
     foreach ($dates as $date) {
         $count_views = isset($visits[$date['date']]['count']) ? $visits[$date['date']]['count'] : 0;
         $count_ads = isset($ads_dates[$date['date']]['count']) ? $ads_dates[$date['date']]['count'] : 0;
         $stats_daily[] = array('date' => $date['date'], 'views' => $count_views, 'ads' => $count_ads);
     }
     $content->stats_daily = $stats_daily;
     //Today
     $query = DB::select(DB::expr('COUNT(id_visit) count'))->from('visits')->where(DB::expr('DATE( created )'), '=', DB::expr('CURDATE()'))->group_by(DB::expr('DATE( created )'))->order_by('created', 'asc')->execute();
     $ads = $query->as_array();
     $content->visits_today = isset($ads[0]['count']) ? $ads[0]['count'] : 0;
     //Yesterday
     $query = DB::select(DB::expr('COUNT(id_visit) count'))->from('visits')->where(DB::expr('DATE( created )'), '=', date('Y-m-d', strtotime('-1 day')))->group_by(DB::expr('DATE( created )'))->order_by('created', 'asc')->execute();
     $ads = $query->as_array();
     $content->visits_yesterday = isset($ads[0]['count']) ? $ads[0]['count'] : 0;
     //Last 30 days visits
     $query = DB::select(DB::expr('COUNT(id_visit) count'))->from('visits')->where('created', 'between', array(date('Y-m-d', strtotime('-30 day')), date::unix2mysql()))->execute();
     $visits = $query->as_array();
     $content->visits_month = isset($visits[0]['count']) ? $visits[0]['count'] : 0;
     //total visits
     $query = DB::select(DB::expr('COUNT(id_visit) count'))->from('visits')->execute();
     $visits = $query->as_array();
     $content->visits_total = isset($visits[0]['count']) ? $visits[0]['count'] : 0;
     /////////////////////ORDERS STATS////////////////////////////////
     //orders created last XX days
     $query = DB::select(DB::expr('DATE(created) date'))->select(DB::expr('COUNT(id_order) count'))->select(DB::expr('SUM(amount) total'))->from('orders')->where('created', 'between', array($my_from_date, $my_to_date))->where('status', '=', Model_Order::STATUS_PAID)->group_by(DB::expr('DATE( created )'))->order_by('date', 'asc')->execute();
     $orders = $query->as_array('date');
     $stats_orders = array();
     foreach ($dates as $date) {
         $count_orders = isset($orders[$date['date']]['count']) ? $orders[$date['date']]['count'] : 0;
         $count_sum = isset($orders[$date['date']]['total']) ? $orders[$date['date']]['total'] : 0;
         $stats_orders[] = array('date' => $date['date'], '#orders' => $count_orders, '$' => $count_sum);
     }
     $content->stats_orders = $stats_orders;
     //Today
     $query = DB::select(DB::expr('COUNT(id_order) count'))->from('orders')->where(DB::expr('DATE( created )'), '=', DB::expr('CURDATE()'))->where('status', '=', Model_Order::STATUS_PAID)->group_by(DB::expr('DATE( created )'))->order_by('created', 'asc')->execute();
     $ads = $query->as_array();
     $content->orders_yesterday = isset($ads[0]['count']) ? $ads[0]['count'] : 0;
//.........这里部分代码省略.........
开发者ID:akram,项目名称:openclassifieds2-jetski,代码行数:101,代码来源:home.php

示例9: before

 /**
  * Automatically executed before the widget action. Can be used to set
  * class properties, do authorization checks, and execute other custom code.
  *
  * @return  void
  */
 public function before()
 {
     //try to get the RSS from the cache
     $rss = Feed::parse($this->rss_url, $this->rss_limit, $this->rss_expire);
     $this->rss_items = $rss;
 }
开发者ID:JeffPedro,项目名称:project-garage-sale,代码行数:12,代码来源:rss.php

示例10: isset

<?php

// Displayed feeds are cached for 5 minutes
if (!Fragment::load('feed:' . $feed . ':' . $limit, Date::MINUTE * 5)) {
    // Parse the feed
    $items = Feed::parse($feed, $limit);
    // Set the "link" and "title" variable names
    isset($link) or $link = 'link';
    isset($title) or $title = 'title';
    foreach ($items as $item) {
        // Clean the title so no one can inject anything
        $clean = html::chars($item[$title]);
        // Shorten it to 50 characters, but don't cut words in half, add 2 so that if the 51st char is a space, it will grab the 52nd character, and the word its attached to, so that the strrpos below works.
        $short = Text::limit_chars($clean, 52, false, true);
        // If the string is longer than 50 chars, cut off the leftover workd from limit_chars, and append '...'
        if (strlen($short) > 50) {
            $short = substr($short, 0, strrpos($short, ' ')) . '&#8230;';
        }
        // At this point, $short is at MAX 51 characters (50 characters of the string + "..."), usually less, because its rare for the words to line up exactly with the 50th character.
        echo '<li>' . HTML::anchor($item[$link], $short, array('title' => $clean)) . '</li>';
    }
    Fragment::save();
}
开发者ID:bluehawk,项目名称:kohanaphp.com,代码行数:23,代码来源:feed.php

示例11: rss_feed

 private function rss_feed()
 {
     // RSS Feed parameters:
     $api_id = 2;
     // api_id = 2 for RSS Feeds
     // Perform gathering for each active RSS feed URL for given project_id
     $rss_feeds = $this->model_gather->get_active_rss_feeds($this->project_id);
     foreach ($rss_feeds as $rss_feed) {
         $total_results_gathered = 0;
         // If RSS feed was set searchable generate search query GET string
         $keyword_str = "";
         if ($rss_feed['searchable']) {
             $num_keywords = count($this->keywords_phrases);
             $i = 0;
             foreach ($this->keywords_phrases as $keyword_phrase) {
                 $i++;
                 $word_split = explode(" ", $keyword_phrase['keyword_phrase']);
                 if (count($word_split) > 1) {
                     // Is phrase (more than 1 word)
                     // Check if searching "exact phrase" -> if so add quotes
                     if ($keyword_phrase['exact_phrase']) {
                         $keyword_str .= '"' . urlencode($keyword_phrase['keyword_phrase']) . '"';
                     } else {
                         $keyword_str .= '(' . urlencode($keyword_phrase['keyword_phrase']) . ')';
                     }
                 } else {
                     // Is single keyword
                     $keyword_str .= urlencode($keyword_phrase['keyword_phrase']);
                 }
                 if ($i < $num_keywords) {
                     $keyword_str .= '+OR+';
                 }
             }
         }
         $connection_retries = 0;
         $this->api_connect_error = 0;
         while (TRUE) {
             // Compile request URL
             $request_url = $rss_feed['url'] . $keyword_str;
             print "Query: {$request_url}\n";
             // Check for connection errors
             try {
                 $status_code = Remote::status($request_url);
             } catch (Exception $e) {
                 $this->api_connect_error = "Error connecting to {$request_url}. Cannot locate host.";
             }
             if (!$this->api_connect_error and ($status_code < 200 or $status_code > 299)) {
                 $this->api_connect_error = "Error connecting to {$request_url}. Status code: {$status_code}";
             }
             if (!$this->api_connect_error) {
                 $rss_output = Feed::parse($request_url);
                 $num_results = count($rss_output);
                 if ($num_results > 0) {
                     // Loop through each result, parse, and store data
                     foreach ($rss_output as $item) {
                         $title = array_key_exists('title', $item) ? $item['title'] : '';
                         $text = array_key_exists('description', $item) ? $item['description'] : '';
                         $date_published_timestamp = array_key_exists('pubDate', $item) ? strtotime($item['pubDate']) : 0;
                         // Append title to text & strip all HTML tags except <br>'s
                         $text = "Title: {$title}<br>{$text}";
                         $text = strip_tags($text, "<br>");
                         // Determine unique identifier, if no URL -> use guid -> if no GUID give error
                         if (array_key_exists('link', $item) and $item['link'] != "") {
                             $url = $item['link'];
                         } else {
                             if (array_key_exists('guid', $item)) {
                                 $url = $item['guid'];
                             } else {
                                 print "Error: item has no URL or GUID. Cannot use.\n";
                                 continue;
                             }
                         }
                         // Add each result to database
                         $require_keywords = $rss_feed['searchable'] ? 0 : 1;
                         // Only require keywords if RSS feed is NOT searchable
                         $total_results_gathered += $this->add_metadata($url, $text, $require_keywords, array('project_id' => $this->project_id, 'api_id' => $api_id, 'date_published' => $date_published_timestamp, 'date_retrieved' => time()));
                     }
                 }
                 break;
             } else {
                 // Retry connecting to API
                 $connection_retries++;
                 // Connection error (only for non-searchable RSS feeds, it is assumed an error has occured if no item comes through the feed after multiple connection attempts)
                 if ($connection_retries > $this->connection_retries) {
                     if (!$rss_feed['searchable']) {
                         $this->model_gather->insert_gather_log(array('project_id' => $this->project_id, 'search_query' => $this->api_connect_error, 'date' => time(), 'results_gathered' => 0, 'error' => 1));
                         $this->api_connect_error = 1;
                     }
                     break;
                 }
             }
         }
         // Add entry to gather log (as long as no errors occurred)
         if (!$this->api_connect_error) {
             $this->model_gather->insert_gather_log(array('project_id' => $this->project_id, 'search_query' => $request_url, 'date' => time(), 'results_gathered' => $total_results_gathered));
         }
     }
 }
开发者ID:peetucket,项目名称:ImpactProbe,代码行数:98,代码来源:gather.php

示例12: exit

         exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
     }
     require_once "SimplePie.class.php";
     if (!isset($_['newUrl'])) {
         break;
     }
     $newFeed = new Feed();
     $newFeed->setUrl(Functions::clean_url($_['newUrl']));
     if ($newFeed->notRegistered()) {
         ///@TODO: avertir l'utilisateur du doublon non ajouté
         $newFeed->getInfos();
         $newFeed->setFolder(isset($_['newUrlCategory']) ? $_['newUrlCategory'] : 1);
         $newFeed->save();
         $enableCache = $configurationManager->get('synchronisationEnableCache') == '' ? 0 : $configurationManager->get('synchronisationEnableCache');
         $forceFeed = $configurationManager->get('synchronisationForceFeed') == '' ? 0 : $configurationManager->get('synchronisationForceFeed');
         $newFeed->parse(time(), $_, $enableCache, $forceFeed);
         Plugin::callHook("action_after_addFeed", array(&$newFeed));
     }
     header('location: ./settings.php#manageBloc');
     break;
 case 'changeFeedFolder':
     if ($myUser == false) {
         exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
     }
     if (isset($_['feed'])) {
         $feedManager->change(array('folder' => $_['folder']), array('id' => $_['feed']));
     }
     header('location: ./settings.php');
     break;
 case 'removeFeed':
     if ($myUser == false) {
开发者ID:Chouchen,项目名称:Leed,代码行数:31,代码来源:action.php

示例13: action_aj

 /**
  * Parses authentic jobs feeds
  *
  * @var Integer $max_days Max of days old to fectch an ad
  */
 private function action_aj($max_days = null)
 {
     // Selects the feed
     $jobs = Feed::parse("http://www.authenticjobs.com/rss/index.xml");
     echo "[Authentic Jobs]\n";
     if (count($jobs) > 0) {
         echo "Found " . count($jobs) . " jobs...\n";
         $new_ads = 0;
         // Iterates and start the actual import
         foreach ($jobs as $key => $job) {
             if ($max_days) {
                 $datetime1 = date_create($job['pubDate']);
                 $datetime2 = date_create('now');
                 $interval = date_diff($datetime1, $datetime2);
                 $diff = (int) $interval->format('%r%a');
                 // If older ignore
                 if ($diff > $max_days) {
                     continue;
                 }
             }
             // Splits the title and company name
             $parse_title = explode(":", $job['title']);
             $job['title'] = $parse_title[1];
             $job['company_name'] = $parse_title[0];
             echo "Fetching: {$job['title']}...";
             // Checks for an existing ad
             $ad = ORM::factory('ad')->where('title', '=', trim($job['title']))->where('company_name', '=', trim($job['company_name']))->find_all();
             // if exists go to gnext
             if ($ad->count() > 0) {
                 echo "[DUPLICATED]\n";
                 continue;
             }
             // Get the page contents
             $page = file_get_html($job['link']);
             // Parse the logo if it exists
             $job['company_logo'] = null;
             $logo = $page->find('a[class=avatar]', 0);
             if ($logo) {
                 $logo = $logo->children(0)->src;
                 $job['company_logo'] = "http://www.authenticjobs.com/" . $logo;
                 if (copy($job['company_logo'], $this->config['global']['base_path'] . "/media/uploads/tmp_file.jpg")) {
                     $job['company_logo'] = $this->save_image($this->config['global']['base_path'] . "/media/uploads/tmp_file.jpg");
                     unlink($this->config['global']['base_path'] . "/media/uploads/tmp_file.jpg");
                 }
             }
             // Get the job type
             $type = $page->find('h4[class=type]', 0)->innertext;
             switch ($type) {
                 case 'Full-time':
                     $job['jobtype_id'] = 1;
                     break;
                 case 'Contract':
                     $job['jobtype_id'] = 2;
                     break;
                 case 'Freelance':
                     $job['jobtype_id'] = 3;
                     break;
                 case 'internship':
                     $job['jobtype_id'] = 4;
                     break;
                 default:
                     $job['jobtype_id'] = 1;
             }
             // Get the company url
             $job['company_url'] = null;
             if ($page->find('li[class=website]', 0)) {
                 $job['company_url'] = $page->find('li[class=website]', 0)->children(1)->href;
             }
             // Checks if this is a telecommuter
             $job['telecommute'] = FALSE;
             if ($page->find('em[class=telecommute]')) {
                 $job['telecommute'] = TRUE;
             }
             // Destroy the page object
             $page->clear();
             unset($page);
             // Finds the location
             $matches = array();
             preg_match("/<p><strong>\\((.+?)\\)/iu", $job['description'], $matches);
             $job['location'] = 'Anywhere';
             if (count($matches) > 0) {
                 $job['location'] = $matches[1];
             }
             // Cleans the description
             echo "[OK]\n";
             $this->add_ad(array('title' => $job['title'], 'description' => $job['description'], 'budget' => null, 'category_id' => null, 'jobtype_id' => $job['jobtype_id'], 'contact' => $job['link'], 'category_id' => 2, 'location' => $job['location'], 'company_name' => $job['company_name'], 'company_url' => $job['company_url'], 'telecommute' => $job['telecommute'], 'created_at' => date("Y-m-d h:i:s", strtotime($job['pubDate'])), 'email' => 'info@gowork.at', 'company_logo' => $job['company_logo'], 'jobboard_id' => 2));
             $new_ads++;
         }
         print "[Authentic Jobs Completed with {$new_ads} new ads]\n\n\n";
     }
 }
开发者ID:hbarroso,项目名称:Goworkat,代码行数:96,代码来源:import.php

示例14: test_parse

 /**
  * Tests that Feed::parse gets the correct number of elements
  *
  * @test
  * @dataProvider provider_parse
  * @covers feed::parse
  * @param string  $source   URL to test
  * @param integer $expected Count of items
  */
 public function test_parse($source, $expected)
 {
     $this->markTestSkipped('We don\'t go to the internet for tests.');
     $this->assertEquals($expected, count(Feed::parse($source)));
 }
开发者ID:EhteshamMehmood,项目名称:BlogMVC,代码行数:14,代码来源:FeedTest.php


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