PHP 클래스 Internacional, Internacional

************************************************************************* Plugin Name: Internacional [Abandoned Plugin] Description: [Abandoned Plugin] Internationalization for your posts. Multiple languages on one blog. Based on concepts by Flickr. Version: 0.2010.11.23 Author: Automattic Author URI: http://automattic.com/ ************************************************************************
파일 보기 프로젝트 열기: Automattic/Internacional

공개 프로퍼티들

프로퍼티 타입 설명
$cookie_name Bad idea to change this after plugin usage
$current_language
$current_url_parts This one's an object
$default_language These will be set later
$disable_query_filter
$fake_all_term Term ID, not an object
$internal_query_count Don't modify this directly
$languages
$real_request_uri
$tax_sql_cache
$taxonomy_name

공개 메소드들

메소드 설명
__construct ( ) Plugin setup
add_custom_columns ( array $columns ) : array Adds new columns on the administrative post listing
add_language_into_url_via_redirect ( ) Redirects to the current URL but with the language in it
add_language_to_post_link ( string $url, object | integer $post ) : string Adds a language slug into the URL (after the site's root, before the relative URL)
add_language_to_url ( string $url, string $language_slug = null ) : string Adds a language slug into a URL (after the site's root, before the relative URL)
add_meta_boxes ( ) Meta box manipulation for the write screens
cancel_redirect_to_self ( string $redirect_url ) : string | false At times redirect_canonical() will attempt to redirect from the URL it thinks it's at to the URL that is actually in the address bar. This function prevents those redirect loops.
change_locale ( string $locale ) : string Changes the locale setting based on the current post language being displayed
create_new_language_term ( string $name, string $slug ) : array | false Creates a new language term. This plugin's term slugs are prefixed to avoid collisions, so this function just makes life easier.
debug_query ( string $query ) : string Output some text for debugging queries
debug_var_dump ( mixed $var ) : mixed var_dump() the passed variable. Used for debugging filters.
debug_wp_redirect ( string $redirect_to ) : string | null Output some text about where a redirect attempt was made to for debugging purposes
do_url_hackery ( ) Takes care of all of the URL hackery
filter_by_language_dropdown ( ) Adds an additional filter dropdown for language to the manage posts page in the admin area
get_post_language ( integer $post_ID ) : object | false Get the language of a post ID
get_tax_sql_cached ( $post_table_name, $type ) * A caching wrapper for get_tax_sql()
get_term ( $value ) : mixed Fetches a taxonomy term by it's slug or ID. This plugin's term slugs are prefixed to avoid collisions, so this function just makes life easier.
get_translations ( integer $post_ID ) : array | false Fetches a list of all versions of a post ID
join_in_taxonomy_table ( string $join, string $post_table_name = null ) : string Modifies a query by JOIN'ing in the taxonomy tables, but only if needed (determined by Internacional::should_modify_query() )
join_in_taxonomy_table_p ( string $join ) : string Modifies a query by JOIN'ing in the taxonomy tables, but only if needed (determined by Internacional::should_modify_query() ) The previous/next post link queries use "p" instead of the actual posts database table name.
language_picker_meta_box ( ) Outputs the contents of the language picker meta box for the write screen
limit_where_by_language ( string $where ) : string Modifies the WHERE part of a query by limiting the results to the current language
list_translations ( string $content ) : string Adds a list of other versions of a post to the end of the passed string (i.e. the_content)
output_custom_columns_content ( $column_name, $post_ID ) Outputs the contents of the custom columns
register_setting_section ( ) Adds a new section to Settings -> Reading
register_sidebar_widget ( ) Registers a sidebar widget
relationship_picker_meta_box ( ) Outputs the contents of the relationship picker meta box for the write screen
save_meta_box_results ( $post_ID, $post ) Saves the results of the custom meta boxes
settings_field_language ( ) Outputs the new settings section for selecting the default language
settings_section ( ) Outputs the new settings section for selecting the default language
should_modify_query ( ) : boolean A helper function to determine if the database queries should be altered to limit the shown data to a single language
strip_slug_prefix ( string | object $slug ) : string | object Strips the prefix out of a slug
wp_loaded ( ) Stuff that needs to run a bit later

메소드 상세

__construct() 공개 메소드

Plugin setup
public __construct ( )

add_custom_columns() 공개 메소드

Adds new columns on the administrative post listing
public add_custom_columns ( array $columns ) : array
$columns array Existing columns.
리턴 array An array of columns with the new ones added.

add_language_into_url_via_redirect() 공개 메소드

Redirects to the current URL but with the language in it

add_language_to_post_link() 공개 메소드

The language slug will be the post's language if it has one, otherwise it'll be the default language
public add_language_to_post_link ( string $url, object | integer $post ) : string
$url string The existing post URL.
$post object | integer A post object or ID.
리턴 string The post URL with a language slug added into it.

add_language_to_url() 공개 메소드

Adds a language slug into a URL (after the site's root, before the relative URL)
public add_language_to_url ( string $url, string $language_slug = null ) : string
$url string A URL.
$language_slug string Optional. A language slug. Defaults to the default language.
리턴 string The modified URL with the language slug in it.

add_meta_boxes() 공개 메소드

Removes a default taxonomy meta box, replaces it with another one, and adds an additional meta box
public add_meta_boxes ( )

cancel_redirect_to_self() 공개 메소드

At times redirect_canonical() will attempt to redirect from the URL it thinks it's at to the URL that is actually in the address bar. This function prevents those redirect loops.
public cancel_redirect_to_self ( string $redirect_url ) : string | false
$redirect_url string The URL that is planned on being redirected to.
리턴 string | false The $redirect_url value if the redirect is okay, false if it matches the real current URL.

change_locale() 공개 메소드

Changes the locale setting based on the current post language being displayed
public change_locale ( string $locale ) : string
$locale string The current locale.
리턴 string The modified locale.

create_new_language_term() 공개 메소드

Creates a new language term. This plugin's term slugs are prefixed to avoid collisions, so this function just makes life easier.
public create_new_language_term ( string $name, string $slug ) : array | false
$name string The language's name
$slug string The non-prefixed slug to create for
리턴 array | false The Term ID and Term Taxonomy ID or false on error

debug_query() 공개 메소드

Output some text for debugging queries
public debug_query ( string $query ) : string
$query string The query
리턴 string The exact value passed to the function

debug_var_dump() 공개 메소드

var_dump() the passed variable. Used for debugging filters.
public debug_var_dump ( mixed $var ) : mixed
$var mixed Any variable
리턴 mixed The passed variable

debug_wp_redirect() 공개 메소드

Output some text about where a redirect attempt was made to for debugging purposes
public debug_wp_redirect ( string $redirect_to ) : string | null
$redirect_to string The URL that will be redirected to
리턴 string | null If debug is off then the original URL will be returned, otherwise this function will exit()

do_url_hackery() 공개 메소드

Parses the URL for a language slug Adds a language slug to the URL if there isn't one Removes the language slug from the URL internally so WordPress doesn't see it
public do_url_hackery ( )

filter_by_language_dropdown() 공개 메소드

Adds an additional filter dropdown for language to the manage posts page in the admin area

get_post_language() 공개 메소드

Get the language of a post ID
public get_post_language ( integer $post_ID ) : object | false
$post_ID integer A post's ID
리턴 object | false The language term object for the given post ID or false if the post doesn't have a language value set.

get_tax_sql_cached() 공개 메소드

* A caching wrapper for get_tax_sql()
public get_tax_sql_cached ( $post_table_name, $type )
$post_table_name The name of the table
$type The query type desired ("where" or "join")

get_term() 공개 메소드

Fetches a taxonomy term by it's slug or ID. This plugin's term slugs are prefixed to avoid collisions, so this function just makes life easier.
public get_term ( $value ) : mixed
리턴 mixed Term Row from database. Will return false if $taxonomy does not exist or $term was not found.

get_translations() 공개 메소드

Fetches a list of all versions of a post ID
public get_translations ( integer $post_ID ) : array | false
$post_ID integer A post's ID
리턴 array | false False if the post is not a translation, otherwise an array in the format language term ID => translated post ID

join_in_taxonomy_table() 공개 메소드

Modifies a query by JOIN'ing in the taxonomy tables, but only if needed (determined by Internacional::should_modify_query() )
public join_in_taxonomy_table ( string $join, string $post_table_name = null ) : string
$join string The passed existing JOIN query part.
$post_table_name string Optional. An alternate name (alias) for the posts database table. Be careful, this isn't validated.
리턴 string A potentially modified JOIN query part.

join_in_taxonomy_table_p() 공개 메소드

Modifies a query by JOIN'ing in the taxonomy tables, but only if needed (determined by Internacional::should_modify_query() ) The previous/next post link queries use "p" instead of the actual posts database table name.
public join_in_taxonomy_table_p ( string $join ) : string
$join string The passed existing JOIN query part.
리턴 string A potentially modified JOIN query part.

language_picker_meta_box() 공개 메소드

Outputs the contents of the language picker meta box for the write screen

limit_where_by_language() 공개 메소드

Modifies the WHERE part of a query by limiting the results to the current language
public limit_where_by_language ( string $where ) : string
$where string The passed existing WHERE query part.
리턴 string A potentially modified WHERE query part.

list_translations() 공개 메소드

Adds a list of other versions of a post to the end of the passed string (i.e. the_content)
public list_translations ( string $content ) : string
$content string The post content
리턴 string The post content with a list of available post languages at the end of it

output_custom_columns_content() 공개 메소드

Outputs the contents of the custom columns
public output_custom_columns_content ( $column_name, $post_ID )

register_setting_section() 공개 메소드

Adds a new section to Settings -> Reading

register_sidebar_widget() 공개 메소드

Registers a sidebar widget

relationship_picker_meta_box() 공개 메소드

Outputs the contents of the relationship picker meta box for the write screen

save_meta_box_results() 공개 메소드

Saves the results of the custom meta boxes
public save_meta_box_results ( $post_ID, $post )

settings_field_language() 공개 메소드

Outputs the new settings section for selecting the default language

settings_section() 공개 메소드

Outputs the new settings section for selecting the default language
public settings_section ( )

should_modify_query() 공개 메소드

A helper function to determine if the database queries should be altered to limit the shown data to a single language
public should_modify_query ( ) : boolean
리턴 boolean Whether or not the database queries should be modified

strip_slug_prefix() 공개 메소드

Strips the prefix out of a slug
public strip_slug_prefix ( string | object $slug ) : string | object
$slug string | object Either a full term object or a slug string
리턴 string | object The passed variable but with the prefix stripped off the slug

wp_loaded() 공개 메소드

Stuff that needs to run a bit later
public wp_loaded ( )

프로퍼티 상세

$current_language 공개적으로 프로퍼티

public $current_language

$current_url_parts 공개적으로 프로퍼티

This one's an object
public $current_url_parts

$default_language 공개적으로 프로퍼티

These will be set later
public $default_language

$disable_query_filter 공개적으로 프로퍼티

public $disable_query_filter

$fake_all_term 공개적으로 프로퍼티

Term ID, not an object
public $fake_all_term

$internal_query_count 공개적으로 프로퍼티

Don't modify this directly
public $internal_query_count

$languages 공개적으로 프로퍼티

public $languages

$real_request_uri 공개적으로 프로퍼티

public $real_request_uri

$tax_sql_cache 공개적으로 프로퍼티

public $tax_sql_cache

$taxonomy_name 공개적으로 프로퍼티

public $taxonomy_name