aBlog2 provides programmers with an set of API (application programming interface) calls that allow them to modify how aBlog2 works. These call can be invoked by the web application that is using aBlog2. For the purposes of this page we are going to assume that aBlog2 was added to the application using a line like
myBlog = new aBlogAppObject(...
This list should be considered preliminary and will be added to as the need arises or as requests are made.
This method displays a blog. It would be used if the blog was created but not initially displayed. For example, an application may want to recover the contents of all the blogs at the very beginning, but only display them when needed. The configuration option display can be used to prevent immediate display.
This method uncreates any existing blogs, but does not remove the data from the database. It effectively resets the blog system so that blogs can be recreated. This exists largely for internal reasons, but it is available to the web application. Note that this can be run on any blog instance and it will remove all blogs. This can be useful if you need to rebuild all your blog displays in a situation such as a change in the user's authority.
Warning: The removeBlog function will leave any application that believes it has already down loaded the blog in a confused state. the application will need to start a new blog or reload the page assuming the page knows what to do if there is no blog at load time.
deleteBlog does what it sounds like, it completely removes a blog. This includes purging all entries and comments associated with the blog from the database. Once this is invoked the information is unrecoverable.
Warning: The deleteblog function will leave any application that believes it has already down loaded the blog in a confused state. the application will need to start a new blog or reload the page assuming the page knows what to do if there is no blog at load time.
resetLanguages resets the display language to be used for the interface. Language is a text string. It should match the setLanguage function in the appropriate language file.
Sets the authority level needed to see the attribution level of postings. The user must have an authority at least as high as the attributionSetting, which is an integer value. Warning: A clever user can almost certainly figure out a way to reset the attribution value on their own so attribution protection should be considered minimal.
Sets the current user and password. This is used to creating new blogs and posts. Normally, these values are rechecked against the authentication system before modifying the database. Note that while aBlog2 determines what a user can do when the blogAppObject is created and only displays appropriate button, resetting the user does not update these displays allowing the user to see more or less than then should. If this is a problem the solution would be to remove and rebuild the blogs.
The API also includes some properties.
The languages property of that aBlogAppObject is an array of possible languages. This is automatically generated based on the languages in the ./languages folder. It can be used to create an interface allowing a user to switch languages. A language selection interface needs to be added to the API but isn’t ready yet.
This object is the object passed to the blogAppObject when it is created. It is possible to reset these values manual as in,
myBlog.configObject.sortOption = false;
but this does not mean that the impact of the change will be see immediately or at all. Many on the configuration options are only important when the blogAppObject is created.
You can also read configObject to find the current settings. For example, myBlog.configObject.language would return the current language. However, we don't promise that all settings are kept up to date. In a few case, the information from the configuration object is moved to another variable and current values are kept there. Usually this is done when the form in the configuration option isn't the best for working. For example, the value of blogOrder is converted to the value sortOrder which, rather than being a boolean is either "DESC" or "ASC". We do not promise that these internal reworkings will be constant over time as we develop aBlog.