Module: Wpxf::WordPress::Urls

Included in:
Module
Defined in:
lib/wpxf/wordpress/urls.rb

Overview

Provides helper methods for generating commonly used WordPress URLs.

Instance Method Summary collapse

Instance Method Details

#wordpress_url_adminString

Returns the WordPress admin URL.

Returns:

  • (String)

    the WordPress admin URL.



53
54
55
# File 'lib/wpxf/wordpress/urls.rb', line 53

def wordpress_url_admin
  normalize_uri(full_uri, 'wp-admin/')
end

#wordpress_url_admin_ajaxString

Returns the WordPress admin AJAX URL.

Returns:

  • (String)

    the WordPress admin AJAX URL.



58
59
60
# File 'lib/wpxf/wordpress/urls.rb', line 58

def wordpress_url_admin_ajax
  normalize_uri(wordpress_url_admin, 'admin-ajax.php')
end

#wordpress_url_admin_optionsString

Returns the admin / plugin options URL.

Returns:

  • (String)

    the admin / plugin options URL.



128
129
130
# File 'lib/wpxf/wordpress/urls.rb', line 128

def wordpress_url_admin_options
  normalize_uri(wordpress_url_admin, 'admin.php')
end

#wordpress_url_admin_postString

Returns the WordPress admin post URL.

Returns:

  • (String)

    the WordPress admin post URL.



63
64
65
# File 'lib/wpxf/wordpress/urls.rb', line 63

def wordpress_url_admin_post
  normalize_uri(wordpress_url_admin, 'admin-post.php')
end

#wordpress_url_admin_profileString

Returns the edit profile page URL.

Returns:

  • (String)

    the edit profile page URL.



113
114
115
# File 'lib/wpxf/wordpress/urls.rb', line 113

def wordpress_url_admin_profile
  normalize_uri(wordpress_url_admin, 'profile.php')
end

#wordpress_url_admin_updateString

Returns the WordPress admin update URL.

Returns:

  • (String)

    the WordPress admin update URL.



68
69
70
# File 'lib/wpxf/wordpress/urls.rb', line 68

def wordpress_url_admin_update
  normalize_uri(wordpress_url_admin, 'update.php')
end

#wordpress_url_atomString

Returns the WordPress ATOM URL.

Returns:

  • (String)

    the WordPress ATOM URL.



33
34
35
# File 'lib/wpxf/wordpress/urls.rb', line 33

def wordpress_url_atom
  normalize_uri(full_uri, 'feed/atom/')
end

#wordpress_url_author(author_id) ⇒ String

Returns the WordPress author URL.

Parameters:

  • author_id (Integer)

    a valid WordPress author ID.

Returns:

  • (String)

    the WordPress author URL.



18
19
20
# File 'lib/wpxf/wordpress/urls.rb', line 18

def wordpress_url_author(author_id)
  normalize_uri(full_uri, "?author=#{author_id}")
end

#wordpress_url_comments_postString

Returns the comment poster URL.

Returns:

  • (String)

    the comment poster URL.



123
124
125
# File 'lib/wpxf/wordpress/urls.rb', line 123

def wordpress_url_comments_post
  normalize_uri(full_uri, 'wp-comments-post.php')
end

#wordpress_url_loginString

Returns the WordPress login URL.

Returns:

  • (String)

    the WordPress login URL.



6
7
8
# File 'lib/wpxf/wordpress/urls.rb', line 6

def 
  normalize_uri(full_uri, 'wp-login.php')
end

#wordpress_url_new_userString

Returns the WordPress new user URL.

Returns:

  • (String)

    the WordPress new user URL.



103
104
105
# File 'lib/wpxf/wordpress/urls.rb', line 103

def wordpress_url_new_user
  normalize_uri(wordpress_url_admin, 'user-new.php')
end

#wordpress_url_opmlString

Returns the WordPress OPML URL.

Returns:

  • (String)

    the WordPress OPML URL.



48
49
50
# File 'lib/wpxf/wordpress/urls.rb', line 48

def wordpress_url_opml
  normalize_uri(full_uri, 'wp-links-opml.php')
end

#wordpress_url_plugin_installString

Returns the WordPress plugin install URL.

Returns:

  • (String)

    the WordPress plugin install URL.



93
94
95
# File 'lib/wpxf/wordpress/urls.rb', line 93

def wordpress_url_plugin_install
  normalize_uri(wordpress_url_admin, 'plugin-install.php')
end

#wordpress_url_plugin_uploadString

Returns the WordPress plugin uploader URL.

Returns:

  • (String)

    the WordPress plugin uploader URL.



98
99
100
# File 'lib/wpxf/wordpress/urls.rb', line 98

def wordpress_url_plugin_upload
  normalize_uri(wordpress_url_admin, 'plugin-install.php?tab=upload')
end

#wordpress_url_pluginsString

Returns the WordPress plugins URL.

Returns:

  • (String)

    the WordPress plugins URL.



78
79
80
# File 'lib/wpxf/wordpress/urls.rb', line 78

def wordpress_url_plugins
  normalize_uri(wordpress_url_wp_content, 'plugins')
end

#wordpress_url_post(post_id) ⇒ String

Returns the URL of the specified WordPress post.

Parameters:

  • post_id (Integer)

    a valid WordPress post ID.

Returns:

  • (String)

    the URL of the specified WordPress post.



12
13
14
# File 'lib/wpxf/wordpress/urls.rb', line 12

def wordpress_url_post(post_id)
  normalize_uri(full_uri, "?p=#{post_id}")
end

#wordpress_url_rdfString

Returns the WordPress RDF URL.

Returns:

  • (String)

    the WordPress RDF URL.



28
29
30
# File 'lib/wpxf/wordpress/urls.rb', line 28

def wordpress_url_rdf
  normalize_uri(full_uri, 'feed/rdf/')
end

#wordpress_url_readmeString

Returns the WordPress readme file URL.

Returns:

  • (String)

    the WordPress readme file URL.



38
39
40
# File 'lib/wpxf/wordpress/urls.rb', line 38

def wordpress_url_readme
  normalize_uri(full_uri, 'readme.html')
end

#wordpress_url_rest_apiString

Returns the base path of the REST API introduced in WordPress 4.7.0.

Returns:

  • (String)

    the base path of the REST API introduced in WordPress 4.7.0.



118
119
120
# File 'lib/wpxf/wordpress/urls.rb', line 118

def wordpress_url_rest_api
  normalize_uri(full_uri, 'wp-json')
end

#wordpress_url_rssString

Returns the WordPress RSS URL.

Returns:

  • (String)

    the WordPress RSS URL.



23
24
25
# File 'lib/wpxf/wordpress/urls.rb', line 23

def wordpress_url_rss
  normalize_uri(full_uri, '?feed=rss2')
end

#wordpress_url_sitemapString

Returns the WordPress sitemap URL.

Returns:

  • (String)

    the WordPress sitemap URL.



43
44
45
# File 'lib/wpxf/wordpress/urls.rb', line 43

def wordpress_url_sitemap
  normalize_uri(full_uri, 'sitemap.xml')
end

#wordpress_url_themesString

Returns the WordPress themes URL.

Returns:

  • (String)

    the WordPress themes URL.



83
84
85
# File 'lib/wpxf/wordpress/urls.rb', line 83

def wordpress_url_themes
  normalize_uri(wordpress_url_wp_content, 'themes')
end

#wordpress_url_uploadsString

Returns the WordPress uploads directory.

Returns:

  • (String)

    the WordPress uploads directory.



108
109
110
# File 'lib/wpxf/wordpress/urls.rb', line 108

def wordpress_url_uploads
  normalize_uri(wordpress_url_wp_content, 'uploads')
end

#wordpress_url_wp_contentString

Returns the WordPress wp-content URL.

Returns:

  • (String)

    the WordPress wp-content URL.



73
74
75
# File 'lib/wpxf/wordpress/urls.rb', line 73

def wordpress_url_wp_content
  normalize_uri(full_uri, wp_content_dir)
end

#wordpress_url_xmlrpcString

Returns the WordPress XMLRPC URL.

Returns:

  • (String)

    the WordPress XMLRPC URL.



88
89
90
# File 'lib/wpxf/wordpress/urls.rb', line 88

def wordpress_url_xmlrpc
  normalize_uri(full_uri, 'xmlrpc.php')
end