PHP Класс gb, gitblog

These values can be overridden in gb-config.php (or somewhere else for that matter).
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$_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)

Свойство Тип Описание
$current_url # Info about the Request

Открытые методы

Метод Описание
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 )

Описание методов

add_filter() статический публичный Метод

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 authenticate ( $force = true, $context = 'gb-admin' )

authenticator() статический публичный Метод

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

categories() статический публичный Метод

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

data() статический публичный Метод

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

deauthorize() статический публичный Метод

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

defer() статический публичный Метод

$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() статический публичный Метод

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

filter() статический публичный Метод

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

glob() статический публичный Метод

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

index() статический публичный Метод

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

index_cachename() статический публичный Метод

static public index_cachename ( $name )

index_path() статический публичный Метод

static public index_path ( $name )

init() статический публичный Метод

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

load_plugins() статический публичный Метод

static public load_plugins ( $context )

load_site_state() статический публичный Метод

Load the site state
static public load_site_state ( )

log() статический публичный Метод

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() статический публичный Метод

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

openlog() статический публичный Метод

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

pathToTheme() статический публичный Метод

static public pathToTheme ( $file = '' )

plugin_check_enabled() статический публичный Метод

static public plugin_check_enabled ( $context, $name )

referrer_url() статический публичный Метод

static public referrer_url ( $fallback_on_http_referer = false )

run_deferred() статический публичный Метод

static public run_deferred ( )

shell() статический публичный Метод

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

stop_observing() статический публичный Метод

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

tags() статический публичный Метод

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

url() статический публичный Метод

static public url ( )

urlToCategories() статический публичный Метод

static public urlToCategories ( $categories )

urlToCategory() статический публичный Метод

static public urlToCategory ( $category )

urlToTag() статический публичный Метод

static public urlToTag ( $tag )

urlToTags() статический публичный Метод

static public urlToTags ( $tags )

url_to() статический публичный Метод

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

verify() статический публичный Метод

static public verify ( )

verify_config() статический публичный Метод

static public verify_config ( )

verify_integrity() статический публичный Метод

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 version_format ( $v )

version_parse() статический публичный Метод

static public version_parse ( $s )

vlog() статический публичный Метод

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

Описание свойств

$_authenticators публичное статическое свойство

public static $_authenticators

$authorized публичное статическое свойство

# Admin authentication
public static $authorized

$categories_prefix публичное статическое свойство

URL prefix for categories
public static $categories_prefix

$comments_cache_fnext публичное статическое свойство

public static $comments_cache_fnext

$content_cache_fnext публичное статическое свойство

public static $content_cache_fnext

$current_url защищенное статическое свойство

# Info about the Request
protected static $current_url

$data_store_class публичное статическое свойство

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

$data_stores публичное статическое свойство

public static $data_stores

$deferred публичное статическое свойство

# defer -- Delayed execution
public static $deferred

$deferred_time_limit публичное статическое свойство

public static $deferred_time_limit

$dir публичное статическое свойство

Absolute path to the gitblog directory
public static $dir

$errors публичное статическое свойство

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

$events публичное статическое свойство

# Events
public static $events

$feed_prefix публичное статическое свойство

URL prefix for the feed
public static $feed_prefix

$filters публичное статическое свойство

# Filters
public static $filters

$index_cache_fnext публичное статическое свойство

public static $index_cache_fnext

$index_prefix публичное статическое свойство

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

$is_404 публичное статическое свойство

public static $is_404

$is_categories публичное статическое свойство

public static $is_categories

$is_feed публичное статическое свойство

public static $is_feed

$is_internal_call публичное статическое свойство

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

$is_page публичное статическое свойство

public static $is_page

$is_post публичное статическое свойство

public static $is_post

$is_posts публичное статическое свойство

public static $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)
public static $is_preview

$is_tags публичное статическое свойство

public static $is_tags

$log_cb публичное статическое свойство

public static $log_cb

$log_filter публичное статическое свойство

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

$log_open публичное статическое свойство

# Logging
public static $log_open

$object_indices публичное статическое свойство

# reading object indices
public static $object_indices

$pages_prefix публичное статическое свойство

URL prefix for pages
public static $pages_prefix

$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).
public static $pathspec_query_key

$plugins_loaded публичное статическое свойство

# Plugins
public static $plugins_loaded

$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.
public static $posts_cn_pattern

$posts_fuzzy_lookup публичное статическое свойство

Enables fuzzy URI matching of posts
public static $posts_fuzzy_lookup

$posts_pagesize публичное статическое свойство

Number of posts per page.
public static $posts_pagesize

$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.
public static $posts_prefix

$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.
public static $preview_query_key

$rebuilders публичное статическое свойство

# GitBlog
public static $rebuilders

$request_query публичное статическое свойство

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

$secret публичное статическое свойство

Shared secret
public static $secret

$settings публичное статическое свойство

A JSONDict
public static $settings

$site_description публичное статическое свойство

Site description
public static $site_description

$site_dir публичное статическое свойство

Absolute path to the site root
public static $site_dir

$site_path публичное статическое свойство

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

$site_state публичное статическое свойство

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

$site_title публичное статическое свойство

Site title
public static $site_title

$site_url публичное статическое свойство

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

$tags_prefix публичное статическое свойство

URL prefix for tags
public static $tags_prefix

$theme_dir публичное статическое свойство

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

$theme_url публичное статическое свойство

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

$title публичное статическое свойство

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

$version публичное статическое свойство

# Constants
public static $version

$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.
public static $version_query_key