PHP Class gb, gitblog

These values can be overridden in gb-config.php (or somewhere else for that matter).
Afficher le fichier Open project: rsms/gitblog Class Usage Examples

Méthodes publiques

Свойство Type Description
$_authenticators
$authorized # Admin authentication
$categories_prefix URL prefix for categories
$comments_cache_fnext
$content_cache_fnext
$data_store_class # data -- arbitrary key-value storage
$data_stores
$deferred # defer -- Delayed execution
$deferred_time_limit
$dir Absolute path to the gitblog directory
$errors Themes should take care of this and display these error messages where appropriate.
$events # Events
$feed_prefix URL prefix for the feed
$filters # Filters
$index_cache_fnext
$index_prefix URL to gitblog index _relative_ to gb::$site_url
$is_404
$is_categories
$is_feed
$is_internal_call True if some part of gitblog (inside the gitblog directory) is the initial invoker
$is_page
$is_post
$is_posts
$is_preview This is automatically set to true by the request handler (end of this file) when all of the following are true: - gb::$preview_query_key is set in the query string (i.e. "?preview") - Client is authorized (gb::$authorized is non-false)
$is_search
$is_tags
$log_cb
$log_filter Disable logging by setting this to -1. See the "Logging" section in gitblog.php for more information.
$log_open # Logging
$object_indices # reading object indices
$pages_prefix URL prefix for pages
$pathspec_query_key When this query string key is set and gb::$is_preview is true, the object specified by pathspec is loaded. This overrides parsing the URI and is needed in cases where there are multiple posts with the same name but with different file extensions (content types).
$plugins_loaded # Plugins
$posts_cn_pattern The granularity of this date is the "bottleneck", or "limiter", for $posts_prefix. If you specify "%Y", $posts_prefix can define patterns with granularity ranging from year to second. But if you set this parameter to "%Y/%m/%d-" the minimum granularity of $posts_prefix goes up to day, which means that this: $posts_prefix = '%Y/%m/' will not work, as day is missing. However this: $posts_prefix = '%y-%m-%e/' and $posts_prefix = '%y/%m/%e/%H/%M/' works fine, as they both have a granularity of one day or more. It's recommended not to alter this value. The only viable case where altering this is if you are posting many many posts every day, thus adding day ($posts_cn_pattern = '%Y/%m/%d-') would give a slight file system performance improvement on most file systems.
$posts_fuzzy_lookup Enables fuzzy URI matching of posts
$posts_pagesize Number of posts per page.
$posts_prefix Need to specify at least year and month. Day, time and so on is optional. Changing this parameter does not affect the cache.
$preview_query_key When this query string key is set and the client is authorized, the same effect as setting $version_query_key to "work" is achieved.
$rebuilders # GitBlog
$request_query 'PATH_INFO' or any other string which will then be matched in $_GET[string]
$secret Shared secret
$settings A JSONDict
$site_description Site description
$site_dir Absolute path to the site root
$site_path Absolute URL path (i.e. starts with a slash) to the site root
$site_state Contains the site.json structure or null if not loaded
$site_title Site title
$site_url Absolute URL to the site root, not including gb::$index_prefix
$tags_prefix URL prefix for tags
$theme_dir Absolute path to current theme. Available when running a theme.
$theme_url Absolute URL to current theme. Available when running a theme.
$title # The following are used at runtime.
$version # Constants
$version_query_key When this query string key is set and the client is authorized, the specified version of a viewed post is displayed rather than the live version.

Protected Properties

Свойство Type Description
$current_url # Info about the Request

Méthodes publiques

Méthode Description
add_filter ( $tag, $func, $priority = 100 ) Add a filter
authenticate ( $force = true, $context = 'gb-admin' )
authenticator ( $context = 'gb-admin' )
categories ( $indexname = 'category-to-objs' )
data ( $name, $default = null )
deauthorize ( $redirect = true, $context = 'gb-admin' )
defer ( $callable ) Schedule $callable for delayed execution.
event ( ) Dispatch an event, optionally with arguments.
filter ( $tag, $value ) Apply filters for $tag on $value
glob ( $pattern, $skip = '/\/$/' ) Glob with PCRE skip filter which defaults to skipping directories.
index ( $name, $fallback = null )
index_cachename ( $name )
index_path ( $name )
init ( $add_sample_content = true, $shared = 'true', $theme = 'default', $mkdirmode = 509 )
load_plugins ( $context )
load_site_state ( ) Load the site state
log ( ) Send a message to syslog.
observe ( $event, $callable ) Register $callable for receiving $event s
openlog ( $ident = null, $options = LOG_PID, $facility = LOG_USER )
pathToTheme ( $file = '' )
plugin_check_enabled ( $context, $name )
referrer_url ( $fallback_on_http_referer = false )
run_deferred ( )
shell ( $cmd, $input = null, $cwd = null, $env = null ) Execute a command inside a shell
stop_observing ( $callable, $event = null ) Unregister $callable from receiving $event s
tags ( $indexname = 'tags-by-popularity' )
url ( )
urlToCategories ( $categories )
urlToCategory ( $category )
urlToTag ( $tag )
urlToTags ( $tags )
url_to ( $part = null, $htmlsafe = true )
verify ( )
verify_config ( )
verify_integrity ( ) Verify integrity of the site, automatically taking any actions to restore it if broken.
version_format ( $v )
version_parse ( $s )
vlog ( $priority, $vargs, $btoffset = 1, $prefix = null )

Method Details

add_filter() static public méthode

Lower number for $priority means earlier execution of $func. If $func returns boolean FALSE the filter chain is broken, not applying any more filter after the one returning FALSE. Returning anything else have no effect.
static public add_filter ( $tag, $func, $priority = 100 )

authenticate() static public méthode

static public authenticate ( $force = true, $context = 'gb-admin' )

authenticator() static public méthode

static public authenticator ( $context = 'gb-admin' )

categories() static public méthode

static public categories ( $indexname = 'category-to-objs' )

data() static public méthode

static public data ( $name, $default = null )

deauthorize() static public méthode

static public deauthorize ( $redirect = true, $context = 'gb-admin' )

defer() static public méthode

$callable will be executed after the response has been sent to the client. This is useful for expensive operations which do not need to send anything to the client. At the first call to defer, deferring will be "activated". This means that output buffering is enabled, keepalive disabled and user-abort is ignored. You can check to see if deferring is enabled by doing a truth check on gb::$deferred. The event "did-activate-deferring" is also posted. Use deferring wth caution. A good example of when delayed execution is a good idea, is how the email-notification plugin defers the mail action (this is actually part of GBMail but this plugin makes good use of it). Events: - "did-activate-deferring" Posted when defer is activated.
static public defer ( $callable )

event() static public méthode

Dispatch an event, optionally with arguments.
static public event ( )

filter() static public méthode

Apply filters for $tag on $value
static public filter ( $tag, $value )

glob() static public méthode

Glob with PCRE skip filter which defaults to skipping directories.
static public glob ( $pattern, $skip = '/\/$/' )

index() static public méthode

static public index ( $name, $fallback = null )

index_cachename() static public méthode

static public index_cachename ( $name )

index_path() static public méthode

static public index_path ( $name )

init() static public méthode

static public init ( $add_sample_content = true, $shared = 'true', $theme = 'default', $mkdirmode = 509 )

load_plugins() static public méthode

static public load_plugins ( $context )

load_site_state() static public méthode

Load the site state
static public load_site_state ( )

log() static public méthode

INT CONSTANT DESCRIPTION ---- ----------- ---------------------------------- 0 LOG_EMERG system is unusable 1 LOG_ALERT action must be taken immediately 2 LOG_CRIT critical conditions 3 LOG_ERR error conditions 4 LOG_WARNING warning conditions 5 LOG_NOTICE normal, but significant, condition 6 LOG_INFO informational message 7 LOG_DEBUG debug-level message
static public log ( )

observe() static public méthode

Register $callable for receiving $event s
static public observe ( $event, $callable )

openlog() static public méthode

static public openlog ( $ident = null, $options = LOG_PID, $facility = LOG_USER )

pathToTheme() static public méthode

static public pathToTheme ( $file = '' )

plugin_check_enabled() static public méthode

static public plugin_check_enabled ( $context, $name )

referrer_url() static public méthode

static public referrer_url ( $fallback_on_http_referer = false )

run_deferred() static public méthode

static public run_deferred ( )

shell() static public méthode

Execute a command inside a shell
static public shell ( $cmd, $input = null, $cwd = null, $env = null )

stop_observing() static public méthode

Unregister $callable from receiving $event s
static public stop_observing ( $callable, $event = null )

tags() static public méthode

static public tags ( $indexname = 'tags-by-popularity' )

url() static public méthode

static public url ( )

urlToCategories() static public méthode

static public urlToCategories ( $categories )

urlToCategory() static public méthode

static public urlToCategory ( $category )

urlToTag() static public méthode

static public urlToTag ( $tag )

urlToTags() static public méthode

static public urlToTags ( $tags )

url_to() static public méthode

static public url_to ( $part = null, $htmlsafe = true )

verify() static public méthode

static public verify ( )

verify_config() static public méthode

static public verify_config ( )

verify_integrity() static public méthode

Return values: 0 Nothing done (everything is probably OK). -1 Error (the error has been logged through trigger_error). 1 gitblog cache was updated. 2 gitdir is missing and need to be created (git init). 3 upgrade performed
static public verify_integrity ( )

version_format() static public méthode

static public version_format ( $v )

version_parse() static public méthode

static public version_parse ( $s )

vlog() static public méthode

static public vlog ( $priority, $vargs, $btoffset = 1, $prefix = null )

Property Details

$_authenticators public_oe static_oe property

public static $_authenticators

$authorized public_oe static_oe property

# Admin authentication
public static $authorized

$categories_prefix public_oe static_oe property

URL prefix for categories
public static $categories_prefix

$comments_cache_fnext public_oe static_oe property

public static $comments_cache_fnext

$content_cache_fnext public_oe static_oe property

public static $content_cache_fnext

$current_url protected_oe static_oe property

# Info about the Request
protected static $current_url

$data_store_class public_oe static_oe property

# data -- arbitrary key-value storage
public static $data_store_class

$data_stores public_oe static_oe property

public static $data_stores

$deferred public_oe static_oe property

# defer -- Delayed execution
public static $deferred

$deferred_time_limit public_oe static_oe property

public static $deferred_time_limit

$dir public_oe static_oe property

Absolute path to the gitblog directory
public static $dir

$errors public_oe static_oe property

Themes should take care of this and display these error messages where appropriate.
public static $errors

$events public_oe static_oe property

# Events
public static $events

$feed_prefix public_oe static_oe property

URL prefix for the feed
public static $feed_prefix

$filters public_oe static_oe property

# Filters
public static $filters

$index_cache_fnext public_oe static_oe property

public static $index_cache_fnext

$index_prefix public_oe static_oe property

URL to gitblog index _relative_ to gb::$site_url
public static $index_prefix

$is_404 public_oe static_oe property

public static $is_404

$is_categories public_oe static_oe property

public static $is_categories

$is_feed public_oe static_oe property

public static $is_feed

$is_internal_call public_oe static_oe property

True if some part of gitblog (inside the gitblog directory) is the initial invoker
public static $is_internal_call

$is_page public_oe static_oe property

public static $is_page

$is_post public_oe static_oe property

public static $is_post

$is_posts public_oe static_oe property

public static $is_posts

$is_preview public_oe static_oe property

This is automatically set to true by the request handler (end of this file) when all of the following are true: - gb::$preview_query_key is set in the query string (i.e. "?preview") - Client is authorized (gb::$authorized is non-false)
public static $is_preview

$is_tags public_oe static_oe property

public static $is_tags

$log_cb public_oe static_oe property

public static $log_cb

$log_filter public_oe static_oe property

Disable logging by setting this to -1. See the "Logging" section in gitblog.php for more information.
public static $log_filter

$log_open public_oe static_oe property

# Logging
public static $log_open

$object_indices public_oe static_oe property

# reading object indices
public static $object_indices

$pages_prefix public_oe static_oe property

URL prefix for pages
public static $pages_prefix

$pathspec_query_key public_oe static_oe property

When this query string key is set and gb::$is_preview is true, the object specified by pathspec is loaded. This overrides parsing the URI and is needed in cases where there are multiple posts with the same name but with different file extensions (content types).
public static $pathspec_query_key

$plugins_loaded public_oe static_oe property

# Plugins
public static $plugins_loaded

$posts_cn_pattern public_oe static_oe property

The granularity of this date is the "bottleneck", or "limiter", for $posts_prefix. If you specify "%Y", $posts_prefix can define patterns with granularity ranging from year to second. But if you set this parameter to "%Y/%m/%d-" the minimum granularity of $posts_prefix goes up to day, which means that this: $posts_prefix = '%Y/%m/' will not work, as day is missing. However this: $posts_prefix = '%y-%m-%e/' and $posts_prefix = '%y/%m/%e/%H/%M/' works fine, as they both have a granularity of one day or more. It's recommended not to alter this value. The only viable case where altering this is if you are posting many many posts every day, thus adding day ($posts_cn_pattern = '%Y/%m/%d-') would give a slight file system performance improvement on most file systems.
public static $posts_cn_pattern

$posts_fuzzy_lookup public_oe static_oe property

Enables fuzzy URI matching of posts
public static $posts_fuzzy_lookup

$posts_pagesize public_oe static_oe property

Number of posts per page.
public static $posts_pagesize

$posts_prefix public_oe static_oe property

Need to specify at least year and month. Day, time and so on is optional. Changing this parameter does not affect the cache.
public static $posts_prefix

$preview_query_key public_oe static_oe property

When this query string key is set and the client is authorized, the same effect as setting $version_query_key to "work" is achieved.
public static $preview_query_key

$rebuilders public_oe static_oe property

# GitBlog
public static $rebuilders

$request_query public_oe static_oe property

'PATH_INFO' or any other string which will then be matched in $_GET[string]
public static $request_query

$secret public_oe static_oe property

Shared secret
public static $secret

$settings public_oe static_oe property

A JSONDict
public static $settings

$site_description public_oe static_oe property

Site description
public static $site_description

$site_dir public_oe static_oe property

Absolute path to the site root
public static $site_dir

$site_path public_oe static_oe property

Absolute URL path (i.e. starts with a slash) to the site root
public static $site_path

$site_state public_oe static_oe property

Contains the site.json structure or null if not loaded
public static $site_state

$site_title public_oe static_oe property

Site title
public static $site_title

$site_url public_oe static_oe property

Absolute URL to the site root, not including gb::$index_prefix
public static $site_url

$tags_prefix public_oe static_oe property

URL prefix for tags
public static $tags_prefix

$theme_dir public_oe static_oe property

Absolute path to current theme. Available when running a theme.
public static $theme_dir

$theme_url public_oe static_oe property

Absolute URL to current theme. Available when running a theme.
public static $theme_url

$title public_oe static_oe property

# The following are used at runtime.
public static $title

$version public_oe static_oe property

# Constants
public static $version

$version_query_key public_oe static_oe property

When this query string key is set and the client is authorized, the specified version of a viewed post is displayed rather than the live version.
public static $version_query_key