mlangenberg (owner)

Revisions

gist: 9679 Download_button fork
public
Public Clone URL: git://gist.github.com/9679.git
Embed All Files: show embed
page_view.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# locatie: /app/views/wordpress/page_view.rb
class PageView
  def initialize(page)
    @page = page
  end
  
  def get_page
    XMLRPC::Marshal.dump_response(
    {
    :page_id => @page.id,
    :title => @page.title,
    :description => @page.description,
    :link => "/pages/#{@page.id}", #url(:page, @page),
    :wp_page_parent_id => @page.parent_id,
    :wp_page_order => @page.page_order,
    :wp_page_parent_title => @page.parent.title
    })
  end
end
wordpress.rb #
1
2
3
4
5
6
7
8
9
10
# locatie: /app/controllers/wordpress.rb
class Wordpress < Application
   only_provides :xml
   
   def get_page
      current_site.authenticate(params[:username], params[:password])
      @page = current_site.find_page(params[:page_id])
      PageView.new(@page).get_page
   end
end