JavaScript API

Search:

Welcome

Login to contribute. Register if you haven't yet.

Need Support?

Search this site to find an answer. If you still need help, post a Question. Private or account-related support inquiries can be made at the Private Support forum.

Stay Informed

Are you receiving EditMe's monthly newsletter? Keep informed of product changes, tutorials and tips. Sign up here.

JavaScript API Class: Site

The Site class is accessible using the "site" implicit object. This class provides access to various site-level functions and properties.

Properties

Name  Type  Access
Description 
adminEmail  String
read
The site's administrative email address as specified in Site Management -> General Settings.
canCreate Boolean
read
True if the current user has sufficient access to create new pages on the site.
canRegister
Boolean
read
True if the site's Registration settings allow for anonymous users to register or request registration as set in Access Controls -> Registration.
className String read Returns "Site" - this can be used to determine the object type if unknown.
commentsDisabled Boolean read True if page comments are disabled at the site level.
defaultDomain  String
read
The site's default domain as specified in Site Management -> General Settings.
description
String
read/write
The value of the Description meta tag set in Site Management -> General Settings.
eventPages Array of Pages read Returns an array of all pages whose name begins with 'EditMeScriptEvents'. These are event pages invoked by EditMe to process events. See JavaScript API Event Handlers.
groups
Array of Groups
read  Returns an array of all the Groups defined in the site.
hasAccessReports Boolean read True if the site has the access reports feature enabled. May vary based on current pricing plan.
hasAds Boolean read True if the site has the EditMe footer ad enabled. May vary based on current pricing plan.
hasAttachmentSearch Boolean read True if the site has the attachment search feature enabled. May vary based on current pricing plan.
hasCommentSearch Boolean read True if the site has the comment search feature enabled. May vary based on current pricing plan.
hasEmailUsers Boolean read True if the site has the email all users feature enabled. May vary based on current pricing plan.
hasForums Boolean read True if the site has the forums feature enabled. May vary based on current pricing plan.
hasLayouts Boolean read True if the site has the layout editing and management feature enabled. May vary based on current pricing plan.
hasModeratedRegistration Boolean read True if the site has the moderated registration feature enabled. May vary based on current pricing plan.
hasPageLayouts Boolean read True if the site has the page-level layout setting enabled. May vary based on current pricing plan.
hasPageSecurity Boolean read True if the site has the page-level security setting enabled. May vary based on current pricing plan.
hasPageStyles Boolean read True if the site has the page-level style sheet setting enabled. May vary based on current pricing plan.
hasScripts Boolean read True if the site has the scripted page editing feature enabled. May vary based on current pricing plan.
hasStyles Boolean read True if the site has the style sheet editing and management feature enabled. May vary based on current pricing plan.
hasTemplates Boolean read True if the site has the page templates feature enabled. May vary based on current pricing plan.
maxPolicies Number read The maximum number of policies that can be created within the site. May vary based on current pricing plan.
maxRecentDays Number read The number of days displayed in the Recent Changes report. May vary based on current pricing plan.
maxVersionDays Number read The number of days page versions are maintained. May vary based on current pricing plan.
notificationFrequency Number read The minimum number of interval hours for email notifications. E.g. 2, 24, 168. May vary based on current pricing plan.
policies
Array of Policies
read
Returns an array of all the Policies defined in the site.
quickEdit
Boolean
read/write True if the Double-click Editing feature is enabled in Site Management -> General Settings.
homePage
String
read/write
The name of the default page for this site as set in Site Management -> General Settings.
keywords String
read/write The value of the Keywords meta tag set in Site Management -> General Settings.
layout
String
read/write
The name of the current layout page for this site as set in Site Settings -> Look & Feel -> Layouts
showTools Boolean
read/write True if the site is configured to show the EditMe Tools menu by default.
stylesheet
String
read/write
The name of the current style sheet page for this site, as set in Site Settings -> Look & Feel -> Styles
timeZone
String
read
Returns the site's default Time Zone.
title
String
read/write
The title for this site as set in Site Management -> General Settings.
users
Array of Users
read  Returns an array of all users in the site. See getUser(String) to get a single user.
wantsAds Boolean read True if the site administrator has checked the "Display EditMe Ad in Footer" option in General Settings.

Functions

Name  Return Type
Description 
getAllPages() Array of Pages Returns an array of up to 250 Page objects with all data populated except for content.  Use the offset version of this function to retrieve lists of more than 250 pages.
getAllPages (Number) Array of Pages Returns an array of up to 250 Page objects with all data populated except for content. The pages are offset by the Number argument. For example, if a site has 300 pages, getAllPages(0) will return the first 250 pages, and getAllPages(250) will return the last 50.
getNotificationStamp (Number)
setNotificationStamp (Number)
Number Gets and sets the last email notification stamp for the given interval. This mechanism makes sure that no changes are missed if a notification is not run or fails for a given interval. Interval is the number of hours, as in 2, 24 or 168.
getPage (String)
Page

Returns a Page object for the given name. Use the exists property of the Page class to determine whether the page returned actually exists.

NOTE: This method should not be used to make edits that will be saved as the page content is returned already processed. For example [[Links]] will return as links, and will get saved as links, and include tags will be replaced with the included content. Use the getPageForEdit(..) function instead. A future change may raise an exception if save() is called on a page returned by this method.

getPage (String, Number)
Page

Returns a specified version of the named page. Use the exists property of the Page class to determine whether the page returned actually exists.

See note above regarding saving results of this method. 

getPageDates([String]) Array of Dates Returns a distinct list of page dates for all pages if String is null. Specify a page name for String to get page dates for that page's child pages.
getPageForEdit(String, [Version]) Page Returns a page without the content processed. For example, [[Links]] and [[include:]] tags will not be processed. This method should be used if a script indents to modify and save the page content. Version is an optional argument specifying the version number to return. If omitted, the current version is returned.
getPageMonths(String) Array of String Returns an array of two digit month numbers (01..12) representing the distinct months of all page dates if String is null. If String is not null, page months for the named page's child pages will be returned.
getPagesByDate(Number, Number, Number, String, Number) Array of Pages

Returns an array of pages sorted by page date and matching the date criteria defined by the arguments. Arguments are used as follows:

  1. Number - Year (e.g. 2008). If 0, pages will not be filtered by year.
  2. Number - Month (1..12). If 0, pages will not be filtered by month.
  3. Number - Day (1..31). If 0, pages will not be filtered by day.
  4. String - Parent page name. If null, the filter will run against all pages that have a page date specified.
  5. Number - Specify the maximum number of pages to return. If <=0 or >1000, a value of 1000 is used.
getPagesByType(String) Array of Pages Returns an array of pages with the specified MIME type. For example, site.getPagesByType('text/css') will return all style sheet pages. Results are ordered by page name.
getPagesStartingWith(String) Array of Pages Returns an array of pages whose name start with the provided string.
getRecentChanges(Date, Boolean)
Array of Pages  Returns an array of pages containing recent changes. The content property of pages in the returned array is populated with the change description seen on the /_Recent report. The Date argument specifies how far back to search for changes. The Boolean argument specifies whether or not minor changes should be included in the results.
getRootPages() Array of Pages
Returns an array of pages that have one or more children specified and no parent page relationships.
getSpecialPages() Array of Pages Returns an array of special pages as managed by the /_SpecialPages and /_Templates system pages. These include pages that are hidden, templates, raw or redirects. Style sheet and layout pages are not included.
getUser(String)  User  Returns the user with the specified name, or null if the name is not found. 
getUserChanges(String)
Array of Pages
Returns an array of page versions created by the named user.
newGroup() Group Creates and returns a blank group object.
newPage()  Page
Creates and returns a blank page object.
newPolicy()  Policy  Creates and returns a blank policy object.
newUser()  User   Creates and returns a blank user object.
search (String)
Array of Pages
Performs the same search that is performed with EditMe's site search page. The 'content' property of each page object contains the snippet of relevant text that would normally be displayed in the search results.

Example

<h1 editme="text site.title">site title goes here</h1>

 

Return to JavaScript API


EditMe News & Blog