PHP 클래스 Pods, pods

상속: implements Iterator
파일 보기 프로젝트 열기: pods-framework/pods 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$alt_data PodsData
$api PodsAPI
$body_classes
$data PodsData
$datatype
$datatype_id
$deprecated
$detail_page string
$display_errors boolean
$fields array
$filters array
$id integer
$limit integer
$meta
$meta_extra
$meta_properties
$offset integer
$page integer | mixed
$page_template SEO related vars for Pod Pages
$page_var string
$pagination boolean
$params array
$pod string
$pod_data array | boolean | mixed | null | void
$pod_id integer
$row Current pod item array
$row_override Override pod item array
$rows Array of pod item arrays
$search boolean
$search_mode string
$search_var string
$sql Last SQL query used by a find()
$total integer
$total_found integer
$ui array

공개 메소드들

메소드 설명
__call ( $name, $args ) : mixed Handle methods that have been deprecated and any aliasing
__construct ( string $pod = null, mixed $id = null ) : Pods Constructor - Pods Framework core
__get ( $name ) : mixed Handle variables that have been deprecated and PodsData vars
add ( array | string $data = null, mixed $value = null ) : integer Add an item to a Pod by giving an array of field data or set a specific field to a specific value if you're just wanting to add a new item but only set one field.
add_to ( string $field, mixed $value, integer $id = null ) : integer Add an item to the values of a relationship field, add a value to a number field (field+1), add time to a date field, or add text to a text field
current ( ) : mixed | boolean Get current Iterator row
data ( ) : array | boolean Return an array of all rows returned from a find() call.
delete ( integer $id = null ) : boolean Delete an item
display ( string | array $name, boolean $single = null ) : string | null | false Return the output for a field. If you want the raw value for use in PHP for custom manipulation, you will want to use field() instead. This function will automatically convert arrays into a list of text such as "Rick, John, and Gary"
do_magic_tags ( string $code ) : string Replace magic tags with their values
duplicate ( integer $id = null ) : integer | boolean Duplicate an item
exists ( ) : boolean Whether a Pod item exists or not when using fetch() or construct with an ID or slug
export ( array $fields = null, integer $id = null, $format = null ) : array | boolean Export an item's data
export_data ( array $params = null ) : array Export data from all items
fetch ( integer $id = null, boolean $explicit_set = true ) : array Fetch an item from a Pod. If $id is null, it will return the next item in the list after running find().
field ( string | array $name, boolean $single = null, boolean $raw = false ) : mixed | null Return the value for a field.
fields ( null $field = null, null $option = null ) : boolean | mixed Return field array from a Pod, a field's data, or a field option
filters ( $params = null ) : string Return a filter form for searching a Pod
find ( array $params = null, integer $limit = 15, string $where = null, string $sql = null ) : Pods Find items of a pod, much like WP_Query, but with advanced table handling.
first_id ( array $params_override = null ) : integer Return the first item ID
form ( array $params = null, string $label = null, string $thank_you = null ) : boolean | mixed Embed a form to add / edit a pod item from within your theme. Provide an array of $fields to include and override options where needed. For WP object based Pods, you can pass through the WP object field names too, such as "post_title" or "post_content" for example.
has ( string $field, mixed $value, integer $id = null ) : boolean Check if an item field has a specific value in it
helper ( string $helper, string $value = null, string $name = null ) : mixed Run a helper within a Pod Page or WP Template
id ( ) : integer Return the item ID
import ( mixed $import_data, boolean $numeric_mode = false, string $format = null ) : array Import data / Save multiple rows of data at once
index ( ) : string Return the item name
input ( string | array $field, $input_name = null, mixed $value = '__null' ) : string Return a field input for a specific field
is ( string $field, mixed $value, integer $id = null ) : boolean Check if an item field is a specific value
is_iterator ( ) : boolean Check if in Iterator mode
key ( ) : integer | boolean Get current Iterator key
last_id ( array $params_override = null ) : integer Return the last item ID
next ( ) : void | boolean Move onto the next Iterator row
next_id ( integer $id = null, $params_override = null ) : integer Return the next item ID, loops at the first id to return the last
nth ( integer | string $nth = null ) : boolean Fetch the nth state
pagination ( $params = null ) : string Display the pagination controls, types supported by default are simple, paginate and advanced. The base and format parameters are used only for the paginate view.
position ( ) : integer Fetch the current position in the loop (starting at 1)
prev_id ( integer $id = null, array $params_override = null ) : integer Return the previous item ID, loops at the last id to return the first
raw ( string | array $name, boolean $single = null ) : string | null | false Return the raw output for a field If you want the raw value for use in PHP for custom manipulation, you will want to use field() instead. This function will automatically convert arrays into a list of text such as "Rick, John, and Gary"
remove_from ( string $field, mixed $value = null, integer $id = null ) : integer Remove an item from the values of a relationship field, remove a value from a number field (field-1), remove time to a date field
reset ( integer $row = null ) : Pods (Re)set the MySQL result pointer
reset_pod ( ) : boolean Reset Pod
rewind ( ) : void | boolean Rewind Iterator
row ( ) : array Return row array for an item
save ( array | string $data = null, mixed $value = null, integer $id = null, array $params = null ) : integer Save an item by giving an array of field data or set a specific field to a specific value.
stop_iterator ( ) : void Turn off Iterator mode to off
template ( $template_name, string $code = null, boolean $deprecated = false ) : mixed Display the page template
total ( ) : integer Fetch the total row count returned by the last call to find(), based on the 'limit' parameter set.
total_found ( ) : integer Fetch the total amount of rows found by the last call to find(), regardless of the 'limit' parameter set.
total_pages ( null | integer $limit = null, null | integer $offset = null, null | integer $total = null ) : integer Fetch the total number of pages, based on total rows found and the last find() limit
ui ( mixed $options = null, boolean $amend = false ) : PodsUI | void Generate UI for Data Management
valid ( ) : boolean Whether this Pod object is valid or not
view ( array $fields = null ) : mixed
zebra ( ) : boolean Fetch the zebra switch

비공개 메소드들

메소드 설명
do_hook ( ) : mixed Handle filters / actions for the class
process_magic_tags ( string $tag ) : string Replace magic tags with their values

메소드 상세

__call() 공개 메소드

Handle methods that have been deprecated and any aliasing
부터: 2.0
public __call ( $name, $args ) : mixed
리턴 mixed

__construct() 공개 메소드

Constructor - Pods Framework core
부터: 1.0.0
public __construct ( string $pod = null, mixed $id = null ) : Pods
$pod string The pod name
$id mixed (optional) The ID or slug, to load a single record; Provide array of $params to run 'find'
리턴 Pods

__get() 공개 메소드

Handle variables that have been deprecated and PodsData vars
부터: 2.0
public __get ( $name ) : mixed
리턴 mixed

add() 공개 메소드

You may be looking for save() in most cases where you're setting a specific field.
또한 보기: PodsAPI::save_pod_item
부터: 2.0
public add ( array | string $data = null, mixed $value = null ) : integer
$data array | string Either an associative array of field information or a field name
$value mixed (optional) Value of the field, if $data is a field name
리턴 integer The item ID

add_to() 공개 메소드

Add an item to the values of a relationship field, add a value to a number field (field+1), add time to a date field, or add text to a text field
또한 보기: PodsAPI::save_pod_item
부터: 2.3
public add_to ( string $field, mixed $value, integer $id = null ) : integer
$field string Field name
$value mixed ID(s) to add, int|float to add to number field, string for dates (+1 week), or string for text
$id integer (optional) ID of the pod item to update
리턴 integer The item ID

current() 공개 메소드

Get current Iterator row
public current ( ) : mixed | boolean
리턴 mixed | boolean

data() 공개 메소드

Most of the time, you will want to loop through data using fetch() instead of using this function.
부터: 2.0
public data ( ) : array | boolean
리턴 array | boolean An array of all rows returned from a find() call, or false if no items returned

delete() 공개 메소드

Delete an item
또한 보기: PodsAPI::delete_pod_item
부터: 2.0
public delete ( integer $id = null ) : boolean
$id integer ID of the Pod item to delete
리턴 boolean Whether the item was successfully deleted

display() 공개 메소드

Return the output for a field. If you want the raw value for use in PHP for custom manipulation, you will want to use field() instead. This function will automatically convert arrays into a list of text such as "Rick, John, and Gary"
부터: 2.0
public display ( string | array $name, boolean $single = null ) : string | null | false
$name string | array The field name, or an associative array of parameters
$single boolean (optional) For tableless fields, to return an array or the first
리턴 string | null | false The output from the field, null if the field doesn't exist, false if no value returned for tableless fields

do_magic_tags() 공개 메소드

Replace magic tags with their values
부터: 2.0
public do_magic_tags ( string $code ) : string
$code string The content to evaluate
리턴 string Code with Magic Tags evaluated

duplicate() 공개 메소드

Duplicate an item
또한 보기: PodsAPI::duplicate_pod_item
부터: 2.0
public duplicate ( integer $id = null ) : integer | boolean
$id integer ID of the pod item to duplicate
리턴 integer | boolean ID of the new pod item

exists() 공개 메소드

Whether a Pod item exists or not when using fetch() or construct with an ID or slug
부터: 2.0
public exists ( ) : boolean
리턴 boolean

export() 공개 메소드

Export an item's data
또한 보기: PodsAPI::export_pod_item
부터: 2.0
public export ( array $fields = null, integer $id = null, $format = null ) : array | boolean
$fields array (optional) Fields to export
$id integer (optional) ID of the pod item to export
리턴 array | boolean Data array of the exported pod item

export_data() 공개 메소드

Export data from all items
또한 보기: PodsAPI::export
부터: 2.3
public export_data ( array $params = null ) : array
$params array An associative array of parameters
리턴 array Data arrays of all exported pod items

fetch() 공개 메소드

You can rewind the list back to the start by using reset(). Providing an $id will fetch a specific item from a Pod, much like a call to pods(), and can handle either an id or slug.
또한 보기: PodsData::fetch
부터: 2.0
public fetch ( integer $id = null, boolean $explicit_set = true ) : array
$id integer ID or slug of the item to fetch
$explicit_set boolean Whether to set explicitly (use false when in loop)
리턴 array An array of fields from the row

field() 공개 메소드

If you are getting a field for output in a theme, most of the time you will want to use display() instead. This function will return arrays for relationship and file fields.
부터: 2.0
public field ( string | array $name, boolean $single = null, boolean $raw = false ) : mixed | null
$name string | array The field name, or an associative array of parameters
$single boolean (optional) For tableless fields, to return the whole array or the just the first item, or an associative array of parameters
$raw boolean (optional) Whether to return the raw value, or to run through the field type's display method, or an associative array of parameters
리턴 mixed | null Value returned depends on the field type, null if the field doesn't exist, false if no value returned for tableless fields

fields() 공개 메소드

Return field array from a Pod, a field's data, or a field option
부터: 2.0
public fields ( null $field = null, null $option = null ) : boolean | mixed
$field null
$option null
리턴 boolean | mixed

filters() 공개 메소드

Return a filter form for searching a Pod
부터: 2.0
public filters ( $params = null ) : string
리턴 string Filters HTML

find() 공개 메소드

Find items of a pod, much like WP_Query, but with advanced table handling.
부터: 2.0
public find ( array $params = null, integer $limit = 15, string $where = null, string $sql = null ) : Pods
$params array An associative array of parameters
$limit integer (optional) (deprecated) Limit the number of items to find, use -1 to return all items with no limit
$where string (optional) (deprecated) SQL WHERE declaration to use
$sql string (optional) (deprecated) For advanced use, a custom SQL query to run
리턴 Pods The pod object

first_id() 공개 메소드

Return the first item ID
부터: 2.3
public first_id ( array $params_override = null ) : integer
$params_override array
리턴 integer

form() 공개 메소드

Embed a form to add / edit a pod item from within your theme. Provide an array of $fields to include and override options where needed. For WP object based Pods, you can pass through the WP object field names too, such as "post_title" or "post_content" for example.
부터: 2.0
public form ( array $params = null, string $label = null, string $thank_you = null ) : boolean | mixed
$params array (optional) Fields to show on the form, defaults to all fields
$label string (optional) Save button label, defaults to "Save Changes"
$thank_you string (optional) Thank you URL to send to upon success
리턴 boolean | mixed

has() 공개 메소드

Check if an item field has a specific value in it
부터: 2.3.3
public has ( string $field, mixed $value, integer $id = null ) : boolean
$field string Field name
$value mixed Value to check
$id integer (optional) ID of the pod item to check
리턴 boolean Whether the value was found

helper() 공개 메소드

Run a helper within a Pod Page or WP Template
또한 보기: Pods_Helpers::helper
부터: 2.0
public helper ( string $helper, string $value = null, string $name = null ) : mixed
$helper string Helper name
$value string Value to run the helper on
$name string Field name
리턴 mixed Anything returned by the helper

id() 공개 메소드

Return the item ID
부터: 2.0
public id ( ) : integer
리턴 integer

import() 공개 메소드

Import data / Save multiple rows of data at once
또한 보기: PodsAPI::import
부터: 2.3
public import ( mixed $import_data, boolean $numeric_mode = false, string $format = null ) : array
$import_data mixed PHP associative array or CSV input
$numeric_mode boolean Use IDs instead of the name field when matching
$format string Format of import data, options are php or csv
리턴 array IDs of imported items

index() 공개 메소드

Return the item name
부터: 2.0
public index ( ) : string
리턴 string

input() 공개 메소드

Return a field input for a specific field
부터: 2.3.10
public input ( string | array $field, $input_name = null, mixed $value = '__null' ) : string
$field string | array Field name or Field data array
$value mixed Current value to use
리턴 string Field Input HTML

is() 공개 메소드

Check if an item field is a specific value
부터: 2.3.3
public is ( string $field, mixed $value, integer $id = null ) : boolean
$field string Field name
$value mixed Value to check
$id integer (optional) ID of the pod item to check
리턴 boolean Whether the value was found

is_iterator() 공개 메소드

Check if in Iterator mode
public is_iterator ( ) : boolean
리턴 boolean

key() 공개 메소드

Get current Iterator key
public key ( ) : integer | boolean
리턴 integer | boolean

last_id() 공개 메소드

Return the last item ID
부터: 2.3
public last_id ( array $params_override = null ) : integer
$params_override array
리턴 integer

next() 공개 메소드

Move onto the next Iterator row
public next ( ) : void | boolean
리턴 void | boolean

next_id() 공개 메소드

Return the next item ID, loops at the first id to return the last
부터: 2.0
public next_id ( integer $id = null, $params_override = null ) : integer
$id integer
리턴 integer

nth() 공개 메소드

Fetch the nth state
또한 보기: PodsData::nth
부터: 2.3
public nth ( integer | string $nth = null ) : boolean
$nth integer | string The $nth to match on the PodsData::row_number
리턴 boolean Whether $nth matches

pagination() 공개 메소드

Display the pagination controls, types supported by default are simple, paginate and advanced. The base and format parameters are used only for the paginate view.
부터: 2.0
public pagination ( $params = null ) : string
리턴 string Pagination HTML

position() 공개 메소드

Fetch the current position in the loop (starting at 1)
또한 보기: PodsData::position
부터: 2.3
public position ( ) : integer
리턴 integer Current row number (+1)

prev_id() 공개 메소드

Return the previous item ID, loops at the last id to return the first
부터: 2.0
public prev_id ( integer $id = null, array $params_override = null ) : integer
$id integer
$params_override array
리턴 integer

raw() 공개 메소드

Return the raw output for a field If you want the raw value for use in PHP for custom manipulation, you will want to use field() instead. This function will automatically convert arrays into a list of text such as "Rick, John, and Gary"
부터: 2.0
public raw ( string | array $name, boolean $single = null ) : string | null | false
$name string | array The field name, or an associative array of parameters
$single boolean (optional) For tableless fields, to return an array or the first
리턴 string | null | false The output from the field, null if the field doesn't exist, false if no value returned for tableless fields

remove_from() 공개 메소드

Remove an item from the values of a relationship field, remove a value from a number field (field-1), remove time to a date field
또한 보기: PodsAPI::save_pod_item
부터: 2.3.3
public remove_from ( string $field, mixed $value = null, integer $id = null ) : integer
$field string Field name
$value mixed ID(s) to add, int|float to add to number field, string for dates (-1 week), or string for text
$id integer (optional) ID of the pod item to update
리턴 integer The item ID

reset() 공개 메소드

(Re)set the MySQL result pointer
또한 보기: PodsData::reset
부터: 2.0
public reset ( integer $row = null ) : Pods
$row integer ID of the row to reset to
리턴 Pods The pod object

reset_pod() 공개 메소드

Reset Pod
또한 보기: PodsAPI::reset_pod
부터: 2.1.1
public reset_pod ( ) : boolean
리턴 boolean Whether the Pod was successfully reset

rewind() 공개 메소드

Rewind Iterator
public rewind ( ) : void | boolean
리턴 void | boolean

row() 공개 메소드

Return row array for an item
부터: 2.0
public row ( ) : array
리턴 array

save() 공개 메소드

Though this function has the capacity to add new items, best practice should direct you to use add() for that instead.
또한 보기: PodsAPI::save_pod_item
부터: 2.0
public save ( array | string $data = null, mixed $value = null, integer $id = null, array $params = null ) : integer
$data array | string Either an associative array of field information or a field name
$value mixed (optional) Value of the field, if $data is a field name
$id integer (optional) ID of the pod item to update
$params array (optional) Additional params to send to save_pod_item
리턴 integer The item ID

stop_iterator() 공개 메소드

Turn off Iterator mode to off
public stop_iterator ( ) : void
리턴 void

template() 공개 메소드

Display the page template
또한 보기: Pods_Templates::template
부터: 2.0
public template ( $template_name, string $code = null, boolean $deprecated = false ) : mixed
$code string Custom template code to use instead
$deprecated boolean Whether to use deprecated functionality based on old function usage
리턴 mixed Template output

total() 공개 메소드

This is different than the total number of rows found in the database, which you can get with total_found().
또한 보기: PodsData::total
부터: 2.0
public total ( ) : integer
리턴 integer Number of rows returned by find(), based on the 'limit' parameter set

total_found() 공개 메소드

This is different than the total number of rows limited by the current call, which you can get with total().
또한 보기: PodsData::total_found
부터: 2.0
public total_found ( ) : integer
리턴 integer Number of rows returned by find(), regardless of the 'limit' parameter

total_pages() 공개 메소드

Fetch the total number of pages, based on total rows found and the last find() limit
부터: 2.3.10
public total_pages ( null | integer $limit = null, null | integer $offset = null, null | integer $total = null ) : integer
$limit null | integer Rows per page
$offset null | integer Offset of rows
$total null | integer Total rows
리턴 integer Number of pages

ui() 공개 메소드

Generate UI for Data Management
부터: 2.3.10
public ui ( mixed $options = null, boolean $amend = false ) : PodsUI | void
$options mixed Array or String containing Pod or Options to be used
$amend boolean Whether to amend the default UI options or replace entirely
리턴 PodsUI | void UI object or void if custom UI used

valid() 공개 메소드

Whether this Pod object is valid or not
부터: 2.0
public valid ( ) : boolean
리턴 boolean

view() 공개 메소드

부터: 2.3.10
public view ( array $fields = null ) : mixed
$fields array (optional) Fields to show in the view, defaults to all fields
리턴 mixed

zebra() 공개 메소드

Fetch the zebra switch
또한 보기: PodsData::zebra
부터: 1.12
public zebra ( ) : boolean
리턴 boolean Zebra state

프로퍼티 상세

$alt_data 공개적으로 프로퍼티

public PodsData $alt_data
리턴 PodsData

$api 공개적으로 프로퍼티

public PodsAPI $api
리턴 PodsAPI

$body_classes 공개적으로 프로퍼티

public $body_classes

$data 공개적으로 프로퍼티

public PodsData $data
리턴 PodsData

$datatype 공개적으로 프로퍼티

public $datatype

$datatype_id 공개적으로 프로퍼티

public $datatype_id

$deprecated 공개적으로 프로퍼티

public $deprecated

$detail_page 공개적으로 프로퍼티

public string $detail_page
리턴 string

$display_errors 공개적으로 프로퍼티

public bool $display_errors
리턴 boolean

$fields 공개적으로 프로퍼티

public array $fields
리턴 array

$filters 공개적으로 프로퍼티

public array $filters
리턴 array

$id 공개적으로 프로퍼티

public int $id
리턴 integer

$limit 공개적으로 프로퍼티

public int $limit
리턴 integer

$meta 공개적으로 프로퍼티

public $meta

$meta_extra 공개적으로 프로퍼티

public $meta_extra

$meta_properties 공개적으로 프로퍼티

public $meta_properties

$offset 공개적으로 프로퍼티

public int $offset
리턴 integer

$page 공개적으로 프로퍼티

public int|mixed $page
리턴 integer | mixed

$page_template 공개적으로 프로퍼티

SEO related vars for Pod Pages
public $page_template

$page_var 공개적으로 프로퍼티

public string $page_var
리턴 string

$pagination 공개적으로 프로퍼티

public bool $pagination
리턴 boolean

$params 공개적으로 프로퍼티

public array $params
리턴 array

$pod 공개적으로 프로퍼티

public string $pod
리턴 string

$pod_data 공개적으로 프로퍼티

public array|bool|mixed|null|void $pod_data
리턴 array | boolean | mixed | null | void

$pod_id 공개적으로 프로퍼티

public int $pod_id
리턴 integer

$row 공개적으로 프로퍼티

Current pod item array
public $row

$row_override 공개적으로 프로퍼티

Override pod item array
public $row_override

$rows 공개적으로 프로퍼티

Array of pod item arrays
public $rows

$search_mode 공개적으로 프로퍼티

public string $search_mode
리턴 string

$search_var 공개적으로 프로퍼티

public string $search_var
리턴 string

$sql 공개적으로 프로퍼티

Last SQL query used by a find()
public $sql

$total 공개적으로 프로퍼티

public int $total
리턴 integer

$total_found 공개적으로 프로퍼티

public int $total_found
리턴 integer

$ui 공개적으로 프로퍼티

public array $ui
리턴 array