S2 (LiveJournal)

From No LJ Ads Wiki

(Redirected from S2)
Jump to: navigation, search
"S2" redirects here. For other uses, see S2 (disambiguation).

Contents

[edit] General Information

S2 was invented as an answer to S1's lack of extensibility. It is officially known as Style System 2.

S2 is written in BML, which is a programming language based on other languages such as C, Java and Perl.

Paid, Permanent and Early Adopter users of LiveJournal can use the Advanced Customizations of S2 to alter the appearance of their journal. Basic and Plus users are left with the basic customizations.

[info]kunzite1 and his minions in [info]component_help have written up some awesome documentation that can be found here.

Revision #8425 can be found here. The live version can be found here.


[edit] Layer Info

author_email webmaster@livejournal.com
author_name LiveJournal Webmaster
majorversion 1
name LiveJournal S2 Core, v1
redist_uniq core1
type core


[edit] Properties Set

color_comment_bar #d0d0ff
comment_userpic_style  
control_strip_bgcolor  
control_strip_bordercolor  
control_strip_fgcolor  
control_strip_linkcolor  
custom_control_strip_colors off
custom_css  
external_stylesheet false
font_base  
font_fallback none
include_default_stylesheet true
lang_current en
lang_dayname_long List: ("", Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday)
lang_dayname_short List: ("", Sun, Mon, Tue, Wed, Thu, Fri, Sat)
lang_dayname_shorter List: ("", S, M, T, W, T, F, S)
lang_fmt_date_long %%month%% %%dayord%%, %%yyyy%%
lang_fmt_date_long_day %%day%%, %%month%% %%dayord%%, %%yyyy%%
lang_fmt_date_med %%mon%%. %%dayord%%, %%yyyy%%
lang_fmt_date_med_day %%da%%, %%mon%%. %%dayord%%, %%yyyy%%
lang_fmt_date_short %%m%%/%%d%%/%%yy%%
lang_fmt_month_long %%month%% %%yyyy%%
lang_fmt_month_med %%mon%% %%yyyy%%
lang_fmt_month_short %%m%%/%%yy%%
lang_fmt_time_short %%hh%%:%%min%% %%a%%m
lang_monthname_long List: ("", January, February, March, April, May, June, July, August, September, October, November, December)
lang_monthname_short List: ("", Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec)
linked_stylesheet  
linklist_support true
page_day_sortorder forward
page_friends_items 20
page_month_textsubjects true
page_recent_items 20
page_year_sortorder forward
reg_firstdayofweek1 sunday
tags_aware false
text_comment_date Date:
text_comment_edittime Edited at
text_comment_from From:
text_comment_frozen Frozen
text_comment_ipaddr IP Address:
text_comment_parent Parent
text_comment_posted Comment successfully posted
text_comment_reply Reply
text_comment_thread Thread
text_day_next Next Day
text_day_prev Previous Day
text_edit_entry Edit Entry
text_edit_tags Edit Tags
text_entry_next Next Entry
text_entry_prev Previous Entry
text_flag Flag
text_friendsfriends Friends of Friends
text_icon_alt_groups [custom friends groups post]
text_icon_alt_private [private post]
text_icon_alt_protected [protected post]
text_max_comments Maximum comments reached
text_mem_add Add to Memories
text_meta_groups Custom Friends Groups
text_meta_location Current Location
text_meta_mood Current Mood
text_meta_music Current Music
text_month_form_btn View
text_month_screened_comments w/ Screened
text_multiform_btn Perform Action
text_multiform_check Select:
text_multiform_conf_delete Delete selected comments?
text_multiform_des Mass action on selected comments:
text_multiform_opt_delete Delete
text_multiform_opt_deletespam Delete as Spam
text_multiform_opt_freeze Freeze
text_multiform_opt_screen Screen
text_multiform_opt_track Track This
text_multiform_opt_unfreeze Unfreeze
text_multiform_opt_unscreen Unscreen
text_multiform_opt_untrack Untrack This
text_noentries_day There were no entries on this day.
text_noentries_recent There are no entries to display.
text_nosubject (no subject)
text_page_summary Page Summary
text_permalink Link
text_post_comment Leave a Comment
text_post_comment_friends Leave a Comment
text_poster_anonymous (Anonymous)
text_read_comments 1 comment // # comments
text_read_comments_friends 1 comment // # comments
text_reply_back Read Comments
text_reply_nocomments Comments have been disabled for this post.
text_reply_nocomments_header Comments Disabled:
text_replyform_header Read Comments
text_skiplinks_back Previous #
text_skiplinks_forward Next #
text_syndicate Syndicate
text_tag_uses 1 use // # uses
text_tags Tags: #
text_tags_page_header Visible Tags
text_tags_section_header Tags
text_tell_friend Tell a Friend
text_unwatch_comments Untrack This
text_view_archive Archive
text_view_friends Friends
text_view_friends_comm Members
text_view_friends_filter Friends (Custom filter)
text_view_friendsfriends Friends of Friends
text_view_friendsfriends_filter Friends of Friends (Custom filter)
text_view_memories Memories
text_view_month View Subjects
text_view_recent Recent Entries
text_view_userinfo User Info
text_watch_comments Track This
text_website_default_name My Website
theme_bgcolor  
theme_bordercolor  
theme_linkcolor  
use_shared_pic false
view_entry_disabled false

[edit] Properties Not Set

IMGDIR [returns string to IMG directory. http://stat.livejournal.com/img]
STATDIR [returns string to STAT directory. http://stat.livejournal.com]
SITENAME [returns string of SITENAME. LiveJournal.com]
SITENAMESHORT [returns string of SITENAMESHORT. LiveJournal]
SITENAMEABBREV [returns string of SITENAMEABBREV. LJ]
SITEROOT [returns string of SITEROOT. http://www.livejournal.com]
PALIMGROOT [returns string to PALIMG directory. http://www.livejournal.com/palimg]
text_skiplinks_foward_words text without a number, use for going forward in pages


[edit] Global Functions

PalItem(int index, Color c) : PalItem Convenience constructor to make populating an array of PalItems (like in palimg_modify) easy.
UserLite(string username) : UserLite Constructor for making a UserLite object from a username
alternate(string a, string b) : string With each call, this function will alternate between the two values and return one of them. Useful for making tables whose rows alternate in background color.
clean_url(string s) : string Returns the given URL back if it's a valid URL.
control_strip_logged_out_full_userpic_css() : string Returns CSS for the loggedout_userpic div in the logged out version of the control strip.
control_strip_logged_out_userpic_css() : string Returns CSS for the userpic div in the logged out version of the control strip.
ehtml(string text) : string Escapes all HTML tags and entities from the text
end_css() : void Declare that you're done printing CSS and the output thus buffered should be cleaned and printed.
etags(string s) : string Escapes all HTML tags (but not entities) from text
eurl(string s) : string URL escape
get_page() : Page Gets the top-level Page instance that LiveJournal ran the Page::print() method on.
get_plural_phrase(int n, string prop) : string Picks the phrase with the proper plural form from those in the property $prop, passing $n to lang_map_plural(int) to get the proper form for the current language, and then substituting the # character with $n. Also, returned string is HTML-escaped.
get_url(UserLite user, string view) : string Returns a URL to the specified view for the specified user. Views use the same names as elsewhere. (recent, friends, archive, month, userinfo)
get_url(string user, string view) : string Returns a URL to the specified view for the specified user. Views use the same names as elsewhere. (recent, friends, archive, month, userinfo)
htmlattr(string name, int value) : string If the value isn't blank, return in HTML attribute format with a leading space. HTML of name is not escaped.
htmlattr(string name, string value) : string If the value isn't blank, return in HTML attribute format with a leading space. HTML of name is not escaped.
int(string s) : int Convert the string to an integer and return
journal_current_datetime() : DateTime Returns the current datetime in the timezone of the journal being viewed.
lang_at_datetime(DateTime d) : string Returns a string saying "at {the data and time given}". Used in the core implementation of EntryPage and ReplyPage. i18nc layers should override this.
lang_map_plural(int n) : int  
lang_metadata_title(string which) : string Get a human-readable caption for a metadata key. Layers shouldn't override this, but should instead set the relevant string properties.
lang_ordinal(int num) : string Make an ordinal number from a cardinal number
lang_ordinal(string num) : string Make an ordinal number from a cardinal number. Don't override this, since the core layer implementation just calls [func[lang_ordinal(int)]], which i18nc layers should override.
lang_page_of_pages(int pg, int pgs): string  
lang_user_wrote(UserLite u) : string Returns text describing that the user wrote something. i18nc layers should override this.
lang_viewname(string viewid) : string Get some words representing a view
pageview_unique_string() : string Returns a unique string for the remote user.
palimg_gradient(string filename, PalItem start, PalItem end) : string Return a URL to the specified filename (relative to the palimg root) with its palette table made into a gradient. All palette entries between the inclusive indexes of $start and $end will fade from the colors in $start and $end. The palette indexes for the start and end can be between 0 and 255.
palimg_modify(string filename, PalItem[] items) : string Return a URL to the specified filename (relative to the palimg root) with its palette table altered, once for each provided PalItem. Restrictions: only 7 palette entries may be modified, and the PalItem indexes must be 0-15.
palimg_tint(string filename, Color bright) : string Return a URL to the specified filename (relative to the palimg root) with its palette table tinted. The given 'bright' color will be the new white, and darkest color remains black.
palimg_tint(string filename, Color bright, Color dark) : string Return a URL to the specified filename (relative to the palimg root) with its palette table tinted. The given 'bright' color will be the new white, and the given 'dark' color will be the new black.
print_custom_control_strip_css() : void Prints the CSS for custom control strip colors, if the option is enabled. This should be called by print_stylesheet().
print_stylesheet() : void Prints a stylesheet, the URL of which can be referenced by Page.stylesheeturl. This is another S2 entry point, in addition to Page::print().
prop_init() : void This function is the first thing called and is the place to set properties based on the values of other properties. It's called before the style system looks at its builtin properties, so if you need to conditionally setup something based on your own custom properties, do it here. You can't print from this function.
rand(int high) : int Returns a random integer between 1 and $high, inclusive.
rand(int low, int high) : int Returns a random integer between $low and $high, inclusive.
secs_to_string(int sec) : string  
server_sig() : void  
set_content_type(string text) : void! Set the HTTP Content-type response header (for example, if outputting XML). Must be called before printing any data.
set_handler(string eventname, string[][] commands) : void  
start_css() : void Declare that you're about to start printing out CSS that should be buffered, then later cleaned when you call end_css(). WARNING: this is not re-entrant. You can't call start_css recursively.
string(int i) : string Returns a string from a integer.
striphtml(string s) : string Similar to ehtml, but the HTML tags are stripped rather than escaped.
style_is_active() : bool Returns if the style (layout and theme) calling it is active based on a hook. If hook isn't defined, returns true always.
userinfoicon(UserLite user) : Image  
userlite_as_string(UserLite ul) : string Deprecated function. Use ljuser() from now on.
userlite_base_url(UserLite ul) : string  
viewer_is_friend() : bool Returns true if the user viewing the page is both logged in, and is a friend of the journal being viewed. Always returns false for communities, since they cannot have friends.
viewer_is_member() : bool Returns true if the user viewing the page is both logged in, and is a member of the community being viewed. Always returns false for personal journals, since they cannot have members.
viewer_is_owner() : bool Returns true if the user viewing the page is both logged in, and is the owner of the content in question. Useful for returning links to manage information, or edit entries.
viewer_logged_in() : bool Returns true if the user viewing the page is logged in. It's recommended that your page links to the site login page if the user isn't logged in.
viewer_sees_ads() : bool Deprecated function. Use viewer_sees_hbox_(top|bottom) or viewer_sees_vbox from now on.
viewer_sees_control_strip() : bool Returns true if reader will see the built in control strip.
viewer_sees_ebox() : bool True if opaque horizontal site-specific content box should be displayed to the user between entries.
viewer_sees_hbox_bottom() : bool True if opaque horizontal site-specific content box should be displayed to the user at the bottom of the page.
viewer_sees_hbox_top() : bool True if opaque horizontal site-specific content box should be displayed to the user at the top of the page.
viewer_sees_vbox() : bool True if opaque vertical site-specific content box should be displayed to the user.
weekdays() : int[]1 Integers representing the days of the week. This will start on Monday (2) or Sunday (1) depending on the property setting for start-of-week and go to Sunday (1) or Saturday (7)
zeropad(int n, int digits) : string Returns the number padded with zeroes so it has the amount of digits indicated.
zeropad(string n, int digits) : string Returns the number padded with zeroes so it has the amount of digits indicated.

[edit] Classes

Alphabetical   Hierarchical

[edit] Array Keys

[edit] Comment.link_keyseq[]

delete_comment
Delete Comment: Deletes the comment. Present if remote viewer is author of comment, author of entry, or owner or maintainer of the journal.
edit_comment
Edit Comment: Edits the comment. Present if remote viewer is author of comment, user is not flagged as "underage," user has cap 'edit_comments', and there are no replies to the comment.
expand_comments
Expand Comment Thread: Expands child comments.
freeze_thread
Freeze Thread: Disables replies to the comment and its children. Present if remote viewer is owner or maintainer of the journal.
screen_comment
Screen Comment: Makes comment only visible to author of comment, author of entry, and owner or maintainer of journal. Comment will be unscreened if replied to by owner of entry or owner or maintainer of journal.
unfreeze_thread
Unfreeze Thread
unscreen_comment
Unscreen Comment
unwatch_thread
Unwatch Thread
watch_thread
Watch Thread: Add comment thread to Message Center. Tracks replies to thread.
watching_parent
Watching Parent: Parent comment already in Message Center and thus watching this one too.

[edit] Comment.metadata{}

picture_keyword
Picture Keyword: Present if posted using non-default userpic.
poster_ip
IP Address of poster. Only present if IP logging is enabled and the remote viewer is the owner or maintainer of the journal.


[edit] Entry.link_keyseq[]

edit_entry
Edit Entry: Present if remote viewer is author of entry or owner or maintainer of journal.
edit_tags
Edit Tags: Present if remote viewer is owner or maintainer of journal or has tagging permissions.
flag
Flag: Logged-in viewers [...] can use the Flag icon on public entries to flag [an] entry [...] as Explicit Adult, Offensive Content, Hate Speech, [etc].2
mem_add
Add to Memories: Present at all times. Might alter behavior to only be present if viewer is logged in.
nav_next
Next Entry: Not actually in the array, but a key nonetheless. Present at all times. Provides a URL to go.bml. However, go.bml is not smart enough to skip entries that the remote viewer does not have permission to see.
nav_prev
Previous Entry: Not actually in the array, but a key nonetheless. Present at all times. Provides a URL to go.bml. However, go.bml is not smart enough to skip entries that the remote viewer does not have permission to see.
tell_friend
Tell a Friend: Send an email to an address that provides a link to the entry.
watch_comments
Watch Comments: Track comments on this entry. Present if remote viewer has ability to use ESN.
unwatch_comments
Unwatch Comments: Stop tracking comments on this entry.

[edit] Entry.metadata{}

groups
Custom Friend Groups
location
Current Location
mood
Current Mood
music
Current Music

[edit] Page.data_link{}

atom
Atom Feed: Available on RecentPage.
rss
RSS Feed: Available on RecentPage.


[edit] Page.view_url{}

archive
Archive/Calendar: http://exampleusername.livejournal.com/calendar
friends
Friends' Entries: http://exampleusername.livejournal.com/friends
recent
Recent Entries: http://exampleusername.livejournal.com/
userinfo
User Info/Profile: http://exampleusername.livejournal.com/profile


[edit] TagDetail.security_counts{}

friends
Number of friends-only/members-only entries
groups
Number of protected entries that are associated with a custom friend group
private
Number of private entries
public
Number of public entries


[edit] UserLite.data_link{}

foaf
FOAF File


[edit] UserLite.link_keyseq[]

add_friend
Add as Friend: http://www.livejournal.com/friends/add.bml?user=exampleusername
memories
Memories
nudge
Nudge
post_entry
Post using Web Update Form
search
Search journal using offsite search engine
tell_friend
Send an email to an address that provides a link to the journal.
todo
ToDo List

[edit] Footnotes

^ : Not implemented in LJ S2.

^ : Text taken from FAQ #281.